vagrant-service-manager 1.0.2 → 1.1.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.config/cucumber.yml +12 -0
- data/.gitignore +14 -1
- data/CHANGELOG.md +10 -1
- data/CONTRIBUTING.adoc +110 -0
- data/Gemfile +9 -4
- data/README.adoc +269 -0
- data/Rakefile +112 -1
- data/features/box-command.feature +45 -0
- data/features/debug-flag.feature +30 -0
- data/features/env-command.feature +51 -0
- data/features/help-command.feature +86 -0
- data/features/openshift.feature +51 -0
- data/features/service-operation.feature +40 -0
- data/features/status-command.feature +31 -0
- data/features/support/env.rb +138 -0
- data/lib/vagrant-service-manager/action/setup_network.rb +1 -1
- data/lib/vagrant-service-manager/command.rb +29 -18
- data/lib/vagrant-service-manager/config.rb +1 -1
- data/lib/vagrant-service-manager/plugin.rb +1 -1
- data/lib/vagrant-service-manager/plugin_logger.rb +32 -0
- data/lib/vagrant-service-manager/plugin_util.rb +15 -12
- data/lib/vagrant-service-manager/service.rb +3 -1
- data/lib/vagrant-service-manager/services/docker.rb +4 -1
- data/lib/vagrant-service-manager/services/kubernetes.rb +1 -1
- data/lib/vagrant-service-manager/services/open_shift.rb +4 -2
- data/lib/vagrant-service-manager/version.rb +2 -2
- data/lib/vagrant-service-manager.rb +1 -1
- data/locales/en.yml +19 -13
- data/plugins/guests/redhat/cap/box_version.rb +4 -2
- data/plugins/guests/redhat/cap/machine_ip.rb +3 -0
- data/plugins/guests/redhat/plugin.rb +1 -0
- data/vagrant-service-manager.gemspec +1 -1
- metadata +16 -6
- data/CONTRIBUTING.md +0 -77
- data/README.md +0 -120
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d72420be6d3f4e17f9e649cfe9236ac0b8709ef
|
4
|
+
data.tar.gz: 7f65631baa320c7602742c9fac835183bbe64810
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7edeefe39c4841c208b050c3d775302bfe803b03567037466eba8cc9969db1540719f495c5b24e0116e1c19abd5189999ab2937d805ed076b5a404fd1631e0b
|
7
|
+
data.tar.gz: c90cf6b537f209728e1cae6e3a08aaf6c1eb884449064f0e018debacb816e878a698aa9d47998431bb18bb8a38e87588752b569d2b62c95ade5ac69ee4c9b38a
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# config/cucumber.yml
|
2
|
+
##YAML Template
|
3
|
+
---
|
4
|
+
default: --profile html
|
5
|
+
|
6
|
+
pretty: --format pretty -b
|
7
|
+
html: --format progress --format html --out=build/features_report.html -b
|
8
|
+
|
9
|
+
help: --tags @help --profile html
|
10
|
+
box: --tags @box --profile html
|
11
|
+
env: --tags @env --profile html
|
12
|
+
openshift: --tags @openshift --profile html
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
3
|
## Unreleased
|
4
|
+
- Updated README to make Installation Instructions clearer @bexelbie
|
5
|
+
- Fix #195 Adding Cucumber and Aruba based acceptance tests @hferentschik
|
6
|
+
- CHANGELOG fix and README update for OS support for tests @budhrg
|
7
|
+
- Fix #188: Name of k8s service not consistent @budhrg
|
8
|
+
- Fix #225: service-manager env throws NameError @budhrg
|
9
|
+
- Fix #168: Extend --debug flag to show plugin activity @budhrg
|
10
|
+
- Don't set private network for unsupported box @budhrg
|
11
|
+
- Convert CONTRIBUTING and README docs to AsciiDoc @bexelbie
|
12
|
+
- Fix #172: Implement "start/enable" service command @budhrg
|
4
13
|
|
5
14
|
## v1.0.2 May 09, 2016
|
6
15
|
- Add --script-readable to env and env docker @bexelbie
|
7
16
|
- Fix #178: Add status command and separate status from env @bexelbie
|
8
|
-
- Fix#173: Shows if kubernetes services is running in the box @navidshaikh
|
17
|
+
- Fix #173: Shows if kubernetes services is running in the box @navidshaikh
|
9
18
|
- Fix #169: Adds command for displaying box routable IP address @navidshaikh
|
10
19
|
- Fix message for box command on default help @budhrg
|
11
20
|
- Fix #184: Make env headers comments for vagrant service-manager env @bexelbie
|
data/CONTRIBUTING.adoc
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
[[contributing-to-vagrant-service-manager]]
|
2
|
+
== Contributing to vagrant-service-manager
|
3
|
+
|
4
|
+
* link:#submitting-issues[Submitting issues]
|
5
|
+
* link:#submitting-pull-requests[Submitting pull requests]
|
6
|
+
** link:#get-started[Get Started]
|
7
|
+
** link:#create-a-topic-branch[Create a topic branch]
|
8
|
+
** link:#code[Code]
|
9
|
+
** link:#commit[Commit]
|
10
|
+
** link:#submit[Submit]
|
11
|
+
* link:#merging-pull-requests[Merging pull requests]
|
12
|
+
|
13
|
+
The following is a set of guidelines for contributing to the
|
14
|
+
vagrant-service-manager plugin.
|
15
|
+
|
16
|
+
These are guidelines, please use your best judgment and feel free to
|
17
|
+
propose changes to this document.
|
18
|
+
|
19
|
+
=== Submitting issues
|
20
|
+
|
21
|
+
You can submit issues with respect to the vagrant-service-manager plugin
|
22
|
+
https://github.com/projectatomic/vagrant-service-manager/issues/new[here].
|
23
|
+
Make sure you include all the relevant details pertaining the issue.
|
24
|
+
|
25
|
+
Before submitting a new issue, it is suggested to check the
|
26
|
+
https://github.com/projectatomic/vagrant-service-manager/issues[existing
|
27
|
+
issues] in order to avoid duplication. The vagrant-service-manager
|
28
|
+
plugin works closely with the
|
29
|
+
https://github.com/projectatomic/adb-atomic-developer-bundle/issues[Atomic
|
30
|
+
Developer Bundle] and the
|
31
|
+
https://github.com/projectatomic/adb-utils/issues[adb-utils] RPM. You
|
32
|
+
may wish to review the issues in both these repositories as well.
|
33
|
+
|
34
|
+
=== Submitting pull requests
|
35
|
+
|
36
|
+
==== Get Started
|
37
|
+
|
38
|
+
If you are just getting started with Git and GitHub there are a few
|
39
|
+
prerequisite steps.
|
40
|
+
|
41
|
+
* Make sure you have a https://github.com/signup/free[GitHub account].
|
42
|
+
* https://help.github.com/articles/fork-a-repo/[Fork] the
|
43
|
+
vagrant-service-manager repository. As discussed in the linked page,
|
44
|
+
this also includes:
|
45
|
+
** https://help.github.com/articles/set-up-git[Setting up] your local
|
46
|
+
git install.
|
47
|
+
** Cloning your fork.
|
48
|
+
|
49
|
+
==== Create a topic branch
|
50
|
+
|
51
|
+
Create a
|
52
|
+
http://git-scm.com/book/en/Git-Branching-Branching-Workflows#Topic-Branches[topic
|
53
|
+
branch] on which you will work. The convention is to name the branch
|
54
|
+
using the issue key you are working on. If there is not already an issue
|
55
|
+
covering the work you want to do, create one (see
|
56
|
+
link:#submitting-issues[submitting issues]). Assuming for example you
|
57
|
+
will be working from the master branch and working on the GitHub issue
|
58
|
+
123 : `git checkout -b issue-123 master`
|
59
|
+
|
60
|
+
==== Code
|
61
|
+
|
62
|
+
Do your work! Refer to the link:README.md#development[development]
|
63
|
+
section in the link:README.md[README] to get started.
|
64
|
+
|
65
|
+
==== Commit
|
66
|
+
|
67
|
+
* Make commits of logical units.
|
68
|
+
* Be sure to use the GitHub issue key in the commit message, eg
|
69
|
+
`Issue #123 ...`.
|
70
|
+
* Make sure you have added the necessary tests for your changes.
|
71
|
+
* Make sure you have added appropriate documentation updates.
|
72
|
+
* Run _all_ the tests to assure nothing else was accidentally broken.
|
73
|
+
|
74
|
+
==== Submit
|
75
|
+
|
76
|
+
* Push your changes to the topic branch in your fork of the repository.
|
77
|
+
* Initiate a https://help.github.com/articles/using-pull-requests/[pull
|
78
|
+
request].
|
79
|
+
* All changes need at least 2 ACKs from maintainers before they will be
|
80
|
+
merged. If the author of the PR is a maintainer, their submission is
|
81
|
+
considered to be the first ACK. Therefore, pull requests from
|
82
|
+
maintainers only need one additional ACK. By "2 ACKs" we mean that two
|
83
|
+
maintainers must acknowledge that the change is a good one.
|
84
|
+
|
85
|
+
=== Merging pull requests
|
86
|
+
|
87
|
+
A project maintainer will merge the pull request. He should avoid using
|
88
|
+
the GitHub UI for the merge and prefer merges over the the command line
|
89
|
+
to avoid merge commits and to keep a linear commit history. Here is an
|
90
|
+
example work-flow assuming issue 123 from above:
|
91
|
+
|
92
|
+
-------------------------------------------------------------------------
|
93
|
+
# Create a local branch for the pull request
|
94
|
+
$ git checkout -b issue-123 master
|
95
|
+
|
96
|
+
# Pull the changes
|
97
|
+
$ git pull <remote of the pull request> issue-123
|
98
|
+
|
99
|
+
# If necessary rebase changes on master to ensure we have a fast forward.
|
100
|
+
$ git rebase -i master
|
101
|
+
|
102
|
+
# If required, update CHANGELOG.md in the unreleased section. Commit!
|
103
|
+
|
104
|
+
# Merge changes into master
|
105
|
+
$ git checkout master
|
106
|
+
$ git merge issue-123
|
107
|
+
|
108
|
+
# Push to origin
|
109
|
+
$ git push origin master
|
110
|
+
-------------------------------------------------------------------------
|
data/Gemfile
CHANGED
@@ -3,11 +3,16 @@ source 'https://rubygems.org'
|
|
3
3
|
gemspec
|
4
4
|
|
5
5
|
group :development do
|
6
|
-
gem 'vagrant',
|
7
|
-
# added as the vagrant component wouldn't build without it
|
8
|
-
gem 'json'
|
6
|
+
gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git'
|
9
7
|
gem 'rake'
|
10
|
-
gem '
|
8
|
+
gem 'vagrant-libvirt'
|
9
|
+
gem 'fog-libvirt', '0.0.3' # https://github.com/pradels/vagrant-libvirt/issues/568
|
10
|
+
gem 'mechanize'
|
11
|
+
gem 'json'
|
12
|
+
gem 'cucumber', '~> 2.1'
|
13
|
+
gem 'aruba', '~> 0.13'
|
14
|
+
gem 'komenda', '~> 0.1.6'
|
15
|
+
gem 'launchy'
|
11
16
|
end
|
12
17
|
|
13
18
|
group :plugins do
|
data/README.adoc
ADDED
@@ -0,0 +1,269 @@
|
|
1
|
+
[[vagrant-service-manager]]
|
2
|
+
== vagrant-service-manager
|
3
|
+
|
4
|
+
* link:#objective[Objective]
|
5
|
+
* link:#installation[Installation]
|
6
|
+
** link:#installing-from-a-rubygems[Installing from a RubyGems]
|
7
|
+
** link:#installing-from-rpm[Installing from RPM]
|
8
|
+
* link:#usage[Usage]
|
9
|
+
** link:#example-execution-of-the-plugin[Example execution of the plugin]
|
10
|
+
** link:#available-commands[Available commands]
|
11
|
+
** link:#exit-codes[Exit codes]
|
12
|
+
** link:#ip-address-detection[IP address detection]
|
13
|
+
* link:#development[Development]
|
14
|
+
** link:#setup[Setup]
|
15
|
+
** link:#acceptance-tests[Acceptance tests]
|
16
|
+
* link:#getting-involved[Getting involved]
|
17
|
+
|
18
|
+
== Objective The vagrant-service-manager plugin is designed to enable
|
19
|
+
easier access to the features and services provided by the
|
20
|
+
https://github.com/projectatomic/adb-atomic-developer-bundle[Atomic
|
21
|
+
Developer Bundle (ADB)]. It provides setup information, including
|
22
|
+
environment variables and certificates, required to access services
|
23
|
+
provided by the ADB and is a must have for most ADB users.
|
24
|
+
|
25
|
+
This plugin makes it easier to use the ADB with host-based tools such as
|
26
|
+
Eclipse and the docker and kubernetes CLI commands. Details on how to
|
27
|
+
use ADB with this plugin can be found in the
|
28
|
+
https://github.com/projectatomic/adb-atomic-developer-bundle/blob/master/docs/using.rst[ADB
|
29
|
+
Documentation].
|
30
|
+
|
31
|
+
== Installation
|
32
|
+
|
33
|
+
The plugin is distributed as both a Ruby Gem and via RPM using the
|
34
|
+
Fedora COPR system.
|
35
|
+
|
36
|
+
=== Installing from a RubyGems
|
37
|
+
|
38
|
+
The vagrant-service-manager
|
39
|
+
https://rubygems.org/gems/vagrant-service-manager[gem] is available on
|
40
|
+
https://rubygems.org[RubyGems] and can be installed via the standard
|
41
|
+
Vagrant plugin installation method:
|
42
|
+
|
43
|
+
------------------------------------------------
|
44
|
+
$ vagrant plugin install vagrant-service-manager
|
45
|
+
------------------------------------------------
|
46
|
+
|
47
|
+
=== Installing from RPM
|
48
|
+
|
49
|
+
The
|
50
|
+
https://copr.fedorainfracloud.org/coprs/nshaikh/vagrant-service-manager/builds/[Copr
|
51
|
+
build] is accessible via the standard COPR access/install method:
|
52
|
+
|
53
|
+
----------------------------------------------------------------------------------
|
54
|
+
$ dnf copr enable nshaikh/vagrant-service-manager
|
55
|
+
$ dnf --enablerepo=nshaikh-vagrant-service-manager install vagrant-service-manager
|
56
|
+
----------------------------------------------------------------------------------
|
57
|
+
|
58
|
+
== Usage
|
59
|
+
|
60
|
+
=== Example execution of the plugin
|
61
|
+
|
62
|
+
1. Install vagrant-service-manager plugin:
|
63
|
+
+
|
64
|
+
----------------------------------------------
|
65
|
+
vagrant plugin install vagrant-service-manager
|
66
|
+
----------------------------------------------
|
67
|
+
2. Download the relevant Vagrantfile for your
|
68
|
+
https://github.com/projectatomic/adb-atomic-developer-bundle[ADB]
|
69
|
+
vagrant box, from the
|
70
|
+
https://github.com/projectatomic/adb-atomic-developer-bundle/tree/master/components/centos[repository].
|
71
|
+
For further details on the usage of custom Vagrantfiles designed for
|
72
|
+
specific use cases, refer to the
|
73
|
+
https://github.com/projectatomic/adb-atomic-developer-bundle/blob/master/docs/using.rst[Usage
|
74
|
+
Documentation].
|
75
|
+
3. Start the ADB vagrant box using `vagrant up`. For detailed
|
76
|
+
instructions consult the
|
77
|
+
https://github.com/projectatomic/adb-atomic-developer-bundle/blob/master/docs/installing.rst[Installation
|
78
|
+
Documentation].
|
79
|
+
+
|
80
|
+
*Note:* When the vagrant-service-manager plugin is loaded and a box is
|
81
|
+
started using the VirtualBox provider, the user needs to add a routable
|
82
|
+
non NAT network interface declaration in the Vagrantfile. If the user
|
83
|
+
does not provide a network declaration in the Vagrantfile, a private
|
84
|
+
DHCP network is added by default and a warning is displayed.
|
85
|
+
|
86
|
+
1. Run the plugin to get environment variables and certificates:
|
87
|
+
+
|
88
|
+
----------------------------------------------------------------------------
|
89
|
+
$ vagrant service-manager env docker
|
90
|
+
# Set the following environment variables to enable access to the
|
91
|
+
# docker daemon running inside of the vagrant virtual machine:
|
92
|
+
export DOCKER_HOST=tcp://172.28.128.4:2376
|
93
|
+
export DOCKER_CERT_PATH=/foo/bar/.vagrant/machines/default/virtualbox/docker
|
94
|
+
export DOCKER_TLS_VERIFY=1
|
95
|
+
export DOCKER_API_VERSION=1.21
|
96
|
+
# run following command to configure your shell:
|
97
|
+
# eval "$(vagrant service-manager env docker)"
|
98
|
+
----------------------------------------------------------------------------
|
99
|
+
+
|
100
|
+
*Note:* The required TLS certificates are copied to the host machine at
|
101
|
+
the time of `vagrant up` itself. Every run of
|
102
|
+
`vagrant service-manager env docker` checks for the validity of the
|
103
|
+
certificates on the host machine by matching the certificates inside the
|
104
|
+
box. If the certificates on the host machine are invalid, this command
|
105
|
+
will also re-download the certificates onto the host machine.
|
106
|
+
|
107
|
+
=== Available commands
|
108
|
+
|
109
|
+
The following section lists the available commands for the plugin and
|
110
|
+
their explanation:
|
111
|
+
|
112
|
+
1. `vagrant service-manager env [service] [--script-readable]`
|
113
|
+
+
|
114
|
+
Displays connection information for all active services in the box in a
|
115
|
+
manner that can be evaluated in a shell. If a `service` is specified,
|
116
|
+
only the information for that service is displayed. When
|
117
|
+
`--script-readable` is specified the output is in `key=value` format.
|
118
|
+
The supported services are: Docker; OpenShift.
|
119
|
+
|
120
|
+
1. `vagrant service-manager box [command]`
|
121
|
+
+
|
122
|
+
Displays box related information like release version, IP etc.
|
123
|
+
|
124
|
+
1. `vagrant service-manager box version [--script-readable]`
|
125
|
+
+
|
126
|
+
Displays the version and release information of the running VM. When
|
127
|
+
`--script-readable` is specified the output is in `key=value` format.
|
128
|
+
|
129
|
+
1. `vagrant service-manager box ip`
|
130
|
+
+
|
131
|
+
Displays the routable IP address of the running VM.
|
132
|
+
|
133
|
+
1. `vagrant service-manager status [service]`
|
134
|
+
+
|
135
|
+
Lists services and their running state. If a `service` is specified only
|
136
|
+
the status of that service is displayed. If no service is provided then
|
137
|
+
only supported orchestrators are reported.
|
138
|
+
|
139
|
+
1. `vagrant service-manager [operation] [service]`
|
140
|
+
+
|
141
|
+
where `operation` could be:
|
142
|
+
|
143
|
+
* `restart` : Restart the given service in the box.
|
144
|
+
* `start` : Start the given service in the box.
|
145
|
+
* `stop` : Stop the given service in the box.
|
146
|
+
+
|
147
|
+
and `service` could be `docker`, `openshift`, `kubernetes` etc.
|
148
|
+
|
149
|
+
1. `vagrant service-manager [command] [--help | -h]`
|
150
|
+
+
|
151
|
+
Displays the possible commands, options and other relevant information
|
152
|
+
for the vagrant-service-manager plugin. If a `command` is specified,
|
153
|
+
only the help relevant to that command is displayed.
|
154
|
+
|
155
|
+
[[debug-flag]]
|
156
|
+
==== Debug Flag
|
157
|
+
|
158
|
+
Append `--debug` flag to enable debug mode.
|
159
|
+
|
160
|
+
_Note_: Debug output from `vagrant-service-manager` is prepended with
|
161
|
+
the following string:
|
162
|
+
|
163
|
+
`DEBUG command: [ service-manager: <command name / log message> ]`
|
164
|
+
|
165
|
+
=== Exit codes
|
166
|
+
|
167
|
+
The following table lists the plugin's exit codes and their meaning:
|
168
|
+
|
169
|
+
[cols=",",options="header",]
|
170
|
+
|=======================================================================
|
171
|
+
|Exit Code Number |Meaning
|
172
|
+
|`0` |No error
|
173
|
+
|
174
|
+
|`1` |Catch all for general errors / Wrong sub-command or option given
|
175
|
+
|
176
|
+
|`3` |Vagrant box is not running and should be running for this command
|
177
|
+
to succeed
|
178
|
+
|
179
|
+
|`126` |A service inside the box is not running / Command invoked cannot
|
180
|
+
execute
|
181
|
+
|=======================================================================
|
182
|
+
|
183
|
+
=== IP address detection
|
184
|
+
|
185
|
+
There is no standardized way of detecting Vagrant box IP addresses. This
|
186
|
+
code uses the last IPv4 address available from the set of configured
|
187
|
+
addresses that are _up_. i.e. if eth0, eth1, and eth2 are all up and
|
188
|
+
have IPv4 addresses, the address on eth2 is used.
|
189
|
+
|
190
|
+
== Development
|
191
|
+
|
192
|
+
=== Setup
|
193
|
+
|
194
|
+
After cloning the repository, install the http://bundler.io/[Bundler]
|
195
|
+
gem:
|
196
|
+
|
197
|
+
---------------------
|
198
|
+
$ gem install bundler
|
199
|
+
---------------------
|
200
|
+
|
201
|
+
Then setup your project dependencies:
|
202
|
+
|
203
|
+
----------------
|
204
|
+
$ bundle install
|
205
|
+
----------------
|
206
|
+
|
207
|
+
The build is driven via rake. All build related tash should be executed
|
208
|
+
in the Bundler environment, e.g. `bundle exec rake clean`. You can get a
|
209
|
+
list of available Rake tasks via:
|
210
|
+
|
211
|
+
---------------------
|
212
|
+
$ bundle exec rake -T
|
213
|
+
---------------------
|
214
|
+
|
215
|
+
=== Acceptance tests
|
216
|
+
|
217
|
+
The source also contains a set of https://cucumber.io/[Cucumber]
|
218
|
+
acceptance tests. They can be run via:
|
219
|
+
|
220
|
+
---------------------------
|
221
|
+
$ bundle exec rake features
|
222
|
+
---------------------------
|
223
|
+
|
224
|
+
_NOTE_: Only Linux OS is supported at present.
|
225
|
+
|
226
|
+
The tests assume that the ADB and CDK box files are available under
|
227
|
+
_build/boxes/adb-<provider>.box_ resp
|
228
|
+
_build/boxes/cdk-<provider>.box_. You can either copy the box files
|
229
|
+
manually or use the _get_adb_ resp. _get_cdk_ Rake tasks.
|
230
|
+
|
231
|
+
Per default only the scenarios for ADB in combination with the
|
232
|
+
VirtualBox provider are run. However, you can also run against CDK
|
233
|
+
and/or use the Libvirt provider using the environment variables _BOX_
|
234
|
+
resp _PROVIDER_:
|
235
|
+
|
236
|
+
-----------------------------------------------------
|
237
|
+
# Run tests against CDK using Libvirt
|
238
|
+
$ bundle exec rake features BOX=cdk PROVIDER=libvirt
|
239
|
+
|
240
|
+
# Run against ADB and CDK (boxes are comma seperated)
|
241
|
+
$ bundle exec rake features BOX=cdk,adb
|
242
|
+
-----------------------------------------------------
|
243
|
+
|
244
|
+
You can also run a single feature specifying the explicit feature file
|
245
|
+
to use:
|
246
|
+
|
247
|
+
-----------------------------------------------------------------------
|
248
|
+
$ bundle exec rake features FEATURE=features/<feature-filename>.feature
|
249
|
+
-----------------------------------------------------------------------
|
250
|
+
|
251
|
+
After test execution the Cucumber test reports can be found under
|
252
|
+
_build/features_report.html_. They can also be opened via
|
253
|
+
|
254
|
+
---------------------------------------
|
255
|
+
$ bundle exec rake features:open_report
|
256
|
+
---------------------------------------
|
257
|
+
|
258
|
+
== Getting involved
|
259
|
+
|
260
|
+
We welcome your input. You can submit issues or pull requests with
|
261
|
+
respect to the vagrant-service-manager plugin. Refer to the
|
262
|
+
https://github.com/projectatomic/vagrant-service-manager/blob/master/CONTRIBUTING.md[contributing
|
263
|
+
guidelines] for detailed information on how to contribute to this
|
264
|
+
plugin.
|
265
|
+
|
266
|
+
You can contact us on:
|
267
|
+
|
268
|
+
* IRC: #atomic and #nulecule on freenode
|
269
|
+
* Mailing List: container-tools@redhat.com
|
data/Rakefile
CHANGED
@@ -1 +1,112 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'cucumber/rake/task'
|
4
|
+
require 'mechanize'
|
5
|
+
require 'fileutils'
|
6
|
+
require 'yaml'
|
7
|
+
require 'launchy'
|
8
|
+
|
9
|
+
CDK_DOWNLOAD_URL='https://access.redhat.com/downloads/content/293/ver=2/rhel---7/2.0.0/x86_64/product-software'
|
10
|
+
CDK_BOX_BASE_NAME='rhel-cdk-kubernetes-7.2-23.x86_64.vagrant'
|
11
|
+
|
12
|
+
CDK_DOWNLOAD_URL_NIGHTLY='http://cdk-builds.usersys.redhat.com/builds/nightly/latest-build'
|
13
|
+
|
14
|
+
ADB_DOWNLOAD_URL='http://cloud.centos.org/centos/7/atomic/images'
|
15
|
+
ADB_BOX_BASE_NAME='AtomicDeveloperBundle-2.1.0-CentOS7'
|
16
|
+
|
17
|
+
CLOBBER.include('pkg')
|
18
|
+
CLEAN.include('build')
|
19
|
+
|
20
|
+
task :init do
|
21
|
+
FileUtils.mkdir_p 'build'
|
22
|
+
puts ENV['FOO']
|
23
|
+
end
|
24
|
+
|
25
|
+
# Cucumber acceptance test tasks
|
26
|
+
Cucumber::Rake::Task.new(:features)
|
27
|
+
task :features => :init
|
28
|
+
|
29
|
+
namespace :features do
|
30
|
+
desc 'Opens the HTML Cucumber test report'
|
31
|
+
task :open_report do
|
32
|
+
Launchy.open('./build/features_report.html')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
desc 'Download latest publicly released / latest nightly build of CDK Vagrant box using the specified provider (default \'virtualbox\', \'false\')'
|
37
|
+
task :get_cdk, [:provider, :nightly] do |t, args|
|
38
|
+
provider = args[:provider].nil? ? 'virtualbox' : args[:provider]
|
39
|
+
use_nightly = args[:nightly].nil? ? false : !!(args[:nightly] =~ /true/)
|
40
|
+
agent = Mechanize.new
|
41
|
+
agent.follow_meta_refresh = true
|
42
|
+
|
43
|
+
if use_nightly
|
44
|
+
agent.ignore_bad_chunking = true
|
45
|
+
agent.get(CDK_DOWNLOAD_URL_NIGHTLY) do |page|
|
46
|
+
page.links.each do |link|
|
47
|
+
if link.href.match(/.*#{Regexp.quote(provider)}.box$/)
|
48
|
+
download_dir = File.join(File.dirname(__FILE__), 'build', 'boxes')
|
49
|
+
unless File.directory?(download_dir)
|
50
|
+
FileUtils.mkdir_p(download_dir)
|
51
|
+
end
|
52
|
+
agent.pluggable_parser.default = Mechanize::Download
|
53
|
+
puts "Downloading #{CDK_DOWNLOAD_URL_NIGHTLY}/#{link.href}"
|
54
|
+
agent.get(link.href).save(File.join(download_dir, "cdk-#{provider}.box"))
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
else
|
59
|
+
agent.get(CDK_DOWNLOAD_URL) do |page|
|
60
|
+
|
61
|
+
# Submit first form which is the redirect to login page form
|
62
|
+
login_page = page.forms.first.submit
|
63
|
+
|
64
|
+
# Submit the login form
|
65
|
+
after_login = login_page.form_with(:name => 'login_form') do |f|
|
66
|
+
username_field = f.field_with(:id => 'username')
|
67
|
+
username_field.value = 'service-manager@mailinator.com'
|
68
|
+
password_field = f.field_with(:id => 'password')
|
69
|
+
password_field.value = 'service-manager'
|
70
|
+
end.click_button
|
71
|
+
|
72
|
+
# There is one more redirect after successful login
|
73
|
+
download_page = after_login.forms.first.submit
|
74
|
+
|
75
|
+
download_page.links.each do |link|
|
76
|
+
if link.href =~ /#{Regexp.quote(CDK_BOX_BASE_NAME)}-#{Regexp.quote(provider)}.box/
|
77
|
+
download_dir = File.join(File.dirname(__FILE__), 'build', 'boxes')
|
78
|
+
unless File.directory?(download_dir)
|
79
|
+
FileUtils.mkdir_p(download_dir)
|
80
|
+
end
|
81
|
+
agent.pluggable_parser.default = Mechanize::Download
|
82
|
+
puts "Downloading #{link.href}"
|
83
|
+
agent.get(link.href).save(File.join(download_dir, "cdk-#{provider}.box"))
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
task :get_cdk => :init
|
90
|
+
|
91
|
+
desc 'Download ADB Vagrant box using the specified provider (default \'virtualbox\')'
|
92
|
+
task :get_adb, [:provider] do |t, args|
|
93
|
+
provider = args[:provider].nil? ? 'virtualbox' : args[:provider]
|
94
|
+
agent = Mechanize.new
|
95
|
+
agent.follow_meta_refresh = true
|
96
|
+
agent.get(ADB_DOWNLOAD_URL) do |page|
|
97
|
+
page.links.each do |link|
|
98
|
+
if match = link.href.match(/#{Regexp.quote(ADB_BOX_BASE_NAME)}-(.*).box/)
|
99
|
+
if match.captures[0].downcase == provider
|
100
|
+
download_dir = File.join(File.dirname(__FILE__), 'build', 'boxes')
|
101
|
+
unless File.directory?(download_dir)
|
102
|
+
FileUtils.mkdir_p(download_dir)
|
103
|
+
end
|
104
|
+
agent.pluggable_parser.default = Mechanize::Download
|
105
|
+
puts "Downloading #{ADB_DOWNLOAD_URL}/#{link.href}"
|
106
|
+
agent.get(link.href).save(File.join(download_dir, "adb-#{provider}.box"))
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
task :get_adb => :init
|
@@ -0,0 +1,45 @@
|
|
1
|
+
Feature: Command output from box command
|
2
|
+
service-manager should return the correct output from box commands
|
3
|
+
|
4
|
+
@box
|
5
|
+
Scenario Outline: Boot and execute box commands
|
6
|
+
Given box is <box>
|
7
|
+
And provider is <provider>
|
8
|
+
And a file named "Vagrantfile" with:
|
9
|
+
"""
|
10
|
+
require 'vagrant-libvirt'
|
11
|
+
|
12
|
+
Vagrant.configure('2') do |config|
|
13
|
+
config.vm.box = '<box>'
|
14
|
+
config.vm.box_url = 'file://../boxes/<box>-<provider>.box'
|
15
|
+
config.vm.network :private_network, ip: '<ip>'
|
16
|
+
config.vm.synced_folder '.', '/vagrant', disabled: true
|
17
|
+
config.servicemanager.services = 'docker'
|
18
|
+
end
|
19
|
+
"""
|
20
|
+
|
21
|
+
When I successfully run `bundle exec vagrant up --provider <provider>`
|
22
|
+
And I run `bundle exec vagrant service-manager box`
|
23
|
+
Then the exit status should be 1
|
24
|
+
And stdout from "bundle exec vagrant service-manager box" should contain:
|
25
|
+
"""
|
26
|
+
Usage: vagrant service-manager box <sub-command> [options]
|
27
|
+
|
28
|
+
Sub-Command:
|
29
|
+
version display version and release information about the running VM
|
30
|
+
ip display routable IP address of the running VM
|
31
|
+
|
32
|
+
Options:
|
33
|
+
--script-readable display information in a script readable format
|
34
|
+
-h, --help print this help
|
35
|
+
"""
|
36
|
+
|
37
|
+
When I successfully run `bundle exec vagrant service-manager box ip`
|
38
|
+
Then stdout from "bundle exec vagrant service-manager box ip" should contain "<ip>"
|
39
|
+
|
40
|
+
Examples:
|
41
|
+
| box | provider | ip |
|
42
|
+
| cdk | virtualbox | 10.10.10.42 |
|
43
|
+
| adb | virtualbox | 10.10.10.42 |
|
44
|
+
| cdk | libvirt | 10.10.10.42 |
|
45
|
+
| adb | libvirt | 10.10.10.42 |
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Feature: Command output from --debug flag
|
2
|
+
service-manager should print the debug logs along with native logs
|
3
|
+
|
4
|
+
@status
|
5
|
+
Scenario Outline: Boot and execute simple env command with debug logs
|
6
|
+
Given box is <box>
|
7
|
+
And provider is <provider>
|
8
|
+
And a file named "Vagrantfile" with:
|
9
|
+
"""
|
10
|
+
require 'vagrant-libvirt'
|
11
|
+
|
12
|
+
Vagrant.configure('2') do |config|
|
13
|
+
config.vm.box = '<box>'
|
14
|
+
config.vm.box_url = 'file://../boxes/<box>-<provider>.box'
|
15
|
+
config.vm.network :private_network, ip: '<ip>'
|
16
|
+
config.vm.synced_folder '.', '/vagrant', disabled: true
|
17
|
+
config.servicemanager.services = 'docker'
|
18
|
+
end
|
19
|
+
"""
|
20
|
+
|
21
|
+
When I successfully run `bundle exec vagrant up --provider <provider>`
|
22
|
+
And I successfully run `bundle exec vagrant service-manager env --debug`
|
23
|
+
Then stdout from "bundle exec vagrant service-manager env --debug" should match /DEBUG command: [ service-manager: env ]/
|
24
|
+
|
25
|
+
Examples:
|
26
|
+
| box | provider | ip |
|
27
|
+
| cdk | virtualbox | 10.10.10.42 |
|
28
|
+
| adb | virtualbox | 10.10.10.42 |
|
29
|
+
| cdk | libvirt | 10.10.10.42 |
|
30
|
+
| adb | libvirt | 10.10.10.42 |
|