vcloud-net_launcher 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +5 -1
- data/README.md +42 -49
- data/Rakefile +2 -2
- data/jenkins.sh +1 -4
- data/jenkins_integration_tests.sh +1 -4
- data/lib/vcloud/net_launcher/version.rb +1 -1
- data/tools/fog_credentials.rb +17 -0
- data/vcloud-net_launcher.gemspec +1 -1
- metadata +6 -6
- data/scripts/generate_fog_conf_file.sh +0 -6
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -22,66 +22,42 @@ Or install it yourself as:
|
|
22
22
|
The form to run the command is
|
23
23
|
vcloud-net-launch networks.yaml
|
24
24
|
|
25
|
-
|
25
|
+
## Credentials
|
26
26
|
|
27
|
-
vCloud Net Launcher is based around [fog]. To use it you'll need to give it
|
28
|
-
|
27
|
+
vCloud Net Launcher is based around [fog](http://fog.io/). To use it you'll need to give it
|
28
|
+
credentials that allow it to talk to a vCloud Director environment.
|
29
29
|
|
30
|
-
|
30
|
+
1. Create a '.fog' file in your home directory.
|
31
31
|
|
32
|
-
|
32
|
+
For example:
|
33
33
|
|
34
|
-
|
34
|
+
test_credentials:
|
35
|
+
vcloud_director_host: 'host.api.example.com'
|
36
|
+
vcloud_director_username: 'username@org_name'
|
37
|
+
vcloud_director_password: ''
|
35
38
|
|
36
|
-
|
37
|
-
vcloud_director_username: 'username@org_name'
|
38
|
-
vcloud_director_password: 'password'
|
39
|
-
vcloud_director_host: 'host.api.example.com'
|
39
|
+
2. Obtain a session token. First, curl the API:
|
40
40
|
|
41
|
-
|
41
|
+
curl -D- -d '' \
|
42
|
+
-H 'Accept: application/*+xml;version=5.1' -u '<username>@<org_name>' \
|
43
|
+
https://<host.api.example.com>/api/sessions
|
42
44
|
|
43
|
-
|
44
|
-
vcloud_director_username: 'username@org_name'
|
45
|
-
vcloud_director_password: 'password'
|
46
|
-
vcloud_director_host: 'host.api.example.com'
|
45
|
+
This will prompt for your password.
|
47
46
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
vcloud_director_host: 'host.api.vendor.net'
|
47
|
+
From the headers returned, the value of the `x-vcloud-authorization` header is your
|
48
|
+
session token, and this will be valid for 30 minutes idle - any activity will extend
|
49
|
+
its life by another 30 minutes.
|
52
50
|
|
53
|
-
|
51
|
+
3. Specify your credentials and session token at the beginning of the command. For example:
|
54
52
|
|
55
|
-
|
53
|
+
FOG_CREDENTIAL=test_credentials \
|
54
|
+
FOG_VCLOUD_TOKEN=AAAABBBBBCCCCCCDDDDDDEEEEEEFFFFF= \
|
55
|
+
vcloud-net-launch
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
An example configuration file is located in [examples/vcloud-net-launch][example_yaml]
|
60
|
-
|
61
|
-
#### 2. Log on externally and supply your session token
|
62
|
-
|
63
|
-
You can choose to log on externally by interacting independently with the API and supplying your session token to the
|
64
|
-
tool by setting the `FOG_VCLOUD_TOKEN` ENV variable. This option reduces the risk footprint by allowing the user to
|
65
|
-
store their credentials in safe storage. The default token lifetime is '30 minutes idle' - any activity extends the life by another 30 mins.
|
66
|
-
|
67
|
-
A basic example of this would be the following:
|
68
|
-
|
69
|
-
curl
|
70
|
-
-D-
|
71
|
-
-d ''
|
72
|
-
-H 'Accept: application/*+xml;version=5.1' -u '<user>@<org>'
|
73
|
-
https://host.com/api/sessions
|
74
|
-
|
75
|
-
This will prompt for your password.
|
76
|
-
|
77
|
-
From the headers returned, select the header below
|
78
|
-
|
79
|
-
x-vcloud-authorization: AAAABBBBBCCCCCCDDDDDDEEEEEEFFFFF=
|
80
|
-
|
81
|
-
Use token as ENV var FOG_VCLOUD_TOKEN
|
82
|
-
|
83
|
-
FOG_VCLOUD_TOKEN=AAAABBBBBCCCCCCDDDDDDEEEEEEFFFFF= vcloud-net-launch networks.yaml
|
57
|
+
You may find it easier to export one or both of the values as environment variables.
|
84
58
|
|
59
|
+
**NB** It is also possible to sidestep the need for the session token by saving your
|
60
|
+
password in the fog file. This is **not recommended**.
|
85
61
|
|
86
62
|
##Supports
|
87
63
|
|
@@ -110,6 +86,16 @@ will need to be removed from the file before it is corrected and run again.
|
|
110
86
|
|
111
87
|
vCloud Net Launcher uses vCloud Core. If you want to use the latest version of vCloud Core, or a local version, you can export some variables. See the Gemfile for details.
|
112
88
|
|
89
|
+
## The vCloud API
|
90
|
+
|
91
|
+
vCloud Tools currently use version 5.1 of the [vCloud API](http://pubs.vmware.com/vcd-51/index.jsp?topic=%2Fcom.vmware.vcloud.api.doc_51%2FGUID-F4BF9D5D-EF66-4D36-A6EB-2086703F6E37.html). Version 5.5 may work but is not currently supported. You should be able to access the 5.1 API in a 5.5 environment, and this *is* currently supported.
|
92
|
+
|
93
|
+
The default version is defined in [Fog](https://github.com/fog/fog/blob/244a049918604eadbcebd3a8eaaf433424fe4617/lib/fog/vcloud_director/compute.rb#L32).
|
94
|
+
|
95
|
+
If you want to be sure you are pinning to 5.1, or use 5.5, you can set the API version to use in your fog file, e.g.
|
96
|
+
|
97
|
+
`vcloud_director_api_version: 5.1`
|
98
|
+
|
113
99
|
## Debugging
|
114
100
|
|
115
101
|
`export EXCON_DEBUG=true` - this will print out the API requests and responses.
|
@@ -118,7 +104,14 @@ vCloud Net Launcher uses vCloud Core. If you want to use the latest version of v
|
|
118
104
|
|
119
105
|
## Testing
|
120
106
|
|
121
|
-
Default target: `bundle exec rake` runs the
|
107
|
+
Default target: `bundle exec rake` runs the cucumber features tests.
|
108
|
+
|
109
|
+
`bundle exec rake integration` runs the integration tests.
|
110
|
+
|
111
|
+
`bundle exec rake features` runs the cucumber features tests.
|
112
|
+
|
113
|
+
There are currently no unit tests here, though the bulk of the logic is
|
114
|
+
tested in vcloud-core.
|
122
115
|
|
123
116
|
You need access to a suitable vCloud Director organization to run the
|
124
117
|
integration tests. It is not necessarily safe to run them against an existing
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'cucumber/rake/task'
|
|
2
2
|
require 'rspec/core/rake_task'
|
3
3
|
require 'gem_publisher'
|
4
4
|
|
5
|
-
task :default => [:
|
5
|
+
task :default => [:features]
|
6
6
|
|
7
7
|
RSpec::Core::RakeTask.new(:spec) do |task|
|
8
8
|
# Set a bogus Fog credential, otherwise it's possible for the unit
|
@@ -12,7 +12,7 @@ RSpec::Core::RakeTask.new(:spec) do |task|
|
|
12
12
|
task.pattern = FileList['spec/vcloud/**/*_spec.rb']
|
13
13
|
end
|
14
14
|
|
15
|
-
Cucumber::Rake::Task.new(:
|
15
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
16
16
|
t.cucumber_opts = "--format pretty --no-source"
|
17
17
|
t.fork = false
|
18
18
|
end
|
data/jenkins.sh
CHANGED
@@ -5,9 +5,6 @@ bundle install --path "${HOME}/bundles/${JOB_NAME}"
|
|
5
5
|
# and rake aefault is currently integration test
|
6
6
|
# bundle exec rake
|
7
7
|
|
8
|
-
./
|
9
|
-
export FOG_RC=fog_integration_test.config
|
10
|
-
bundle exec rake integration
|
11
|
-
rm fog_integration_test.config
|
8
|
+
RUBYOPT="-r ./tools/fog_credentials" bundle exec rake integration
|
12
9
|
|
13
10
|
bundle exec rake publish_gem
|
@@ -2,7 +2,4 @@
|
|
2
2
|
set -e
|
3
3
|
bundle install --path "${HOME}/bundles/${JOB_NAME}"
|
4
4
|
|
5
|
-
./
|
6
|
-
export FOG_RC=fog_integration_test.config
|
7
|
-
bundle exec rake integration
|
8
|
-
rm fog_integration_test.config
|
5
|
+
RUBYOPT="-r ./tools/fog_credentials" bundle exec rake integration
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Initialiser for getting vCloud credentials into Fog from Jenkins build
|
2
|
+
# parameters, without needing to write them to disk. To be used with:
|
3
|
+
#
|
4
|
+
# RUBYOPT="-r ./tools/fog_credentials" bundle exec integration
|
5
|
+
#
|
6
|
+
# Replace with FOG_VCLOUD_TOKEN support when we have a tool:
|
7
|
+
#
|
8
|
+
# https://www.pivotaltracker.com/story/show/68989754
|
9
|
+
#
|
10
|
+
require 'bundler/setup'
|
11
|
+
require 'fog'
|
12
|
+
|
13
|
+
Fog.credentials = {
|
14
|
+
:vcloud_director_host => ENV['API_HOST'],
|
15
|
+
:vcloud_director_username => ENV['API_USERNAME'],
|
16
|
+
:vcloud_director_password => ENV['API_PASSWORD'],
|
17
|
+
}
|
data/vcloud-net_launcher.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.required_ruby_version = '>= 1.9.2'
|
24
24
|
|
25
25
|
s.add_runtime_dependency 'methadone'
|
26
|
-
s.add_runtime_dependency 'vcloud-core', '
|
26
|
+
s.add_runtime_dependency 'vcloud-core', '~> 0.0.12'
|
27
27
|
s.add_development_dependency 'aruba', '~> 0.5.3'
|
28
28
|
s.add_development_dependency 'cucumber', '~> 1.3.10'
|
29
29
|
s.add_development_dependency 'gem_publisher', '1.2.0'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vcloud-net_launcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: methadone
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: 0.0.12
|
38
38
|
type: :runtime
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: 0.0.12
|
46
46
|
- !ruby/object:Gem::Dependency
|
@@ -149,13 +149,13 @@ files:
|
|
149
149
|
- lib/vcloud/net_launcher/net_launch.rb
|
150
150
|
- lib/vcloud/net_launcher/version.rb
|
151
151
|
- scripts/basic.erb
|
152
|
-
- scripts/generate_fog_conf_file.sh
|
153
152
|
- spec/erb_helper.rb
|
154
153
|
- spec/integration/net_launcher/data/minimum_data_setup.yaml.erb
|
155
154
|
- spec/integration/net_launcher/org_vdc_network_spec.rb
|
156
155
|
- spec/integration/net_launcher/vcloud_net_launcher_spec.rb
|
157
156
|
- spec/spec_helper.rb
|
158
157
|
- spec/support/stub_fog_interface.rb
|
158
|
+
- tools/fog_credentials.rb
|
159
159
|
- vcloud-net_launcher.gemspec
|
160
160
|
homepage: http://github.com/alphagov/vcloud-net_launcher
|
161
161
|
licenses:
|
@@ -178,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
178
|
version: '0'
|
179
179
|
segments:
|
180
180
|
- 0
|
181
|
-
hash:
|
181
|
+
hash: 2644140563289251804
|
182
182
|
requirements: []
|
183
183
|
rubyforge_project:
|
184
184
|
rubygems_version: 1.8.23
|