vcloud-launcher 0.2.0 → 0.3.0

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/.gitignore CHANGED
@@ -1,13 +1,9 @@
1
1
  *.gem
2
2
  *.rbc
3
- *.swp
4
- *.un~
5
3
  /.bundle/
6
4
  /.ruby-version
7
5
  /Gemfile.lock
8
- /bundle/
9
6
  /coverage/
10
7
  /pkg/
11
8
  fog_integration_test.config
12
- .idea
13
9
  /spec/integration/vcloud_tools_testing_config.yaml
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 0.3.0 (2014-08-08)
2
+
3
+ This release bumps the dependency to vCloud Core 0.9.0:
4
+
5
+ - New vcloud-login tool for fetching session tokens without the need to
6
+ store your password in a plaintext FOG_RC file.
7
+ - Deprecates the use of :vcloud_director_password in a plaintext FOG_RC
8
+ file. A warning will be printed to STDERR at load time. Please use
9
+ vcloud-login instead.
10
+ - This gem no longer directly references fog, instead using vCloud Core's
11
+ API for its interaction with the vCloud API.
12
+
1
13
  ## 0.2.0 (2014-07-14)
2
14
 
3
15
  Features:
data/README.md CHANGED
@@ -51,40 +51,7 @@ Configuration schemas can be found in [`lib/vcloud/launcher/schema/`][schema].
51
51
 
52
52
  ## Credentials
53
53
 
54
- vCloud Launcher is based around [fog](http://fog.io/). To use it you'll need to give it
55
- credentials that allow it to talk to a vCloud Director environment.
56
-
57
- 1. Create a '.fog' file in your home directory.
58
-
59
- For example:
60
-
61
- test_credentials:
62
- vcloud_director_host: 'host.api.example.com'
63
- vcloud_director_username: 'username@org_name'
64
- vcloud_director_password: ''
65
-
66
- 2. Obtain a session token. First, curl the API:
67
-
68
- curl -D- -d '' \
69
- -H 'Accept: application/*+xml;version=5.1' -u '<username>@<org_name>' \
70
- https://<host.api.example.com>/api/sessions
71
-
72
- This will prompt for your password.
73
-
74
- From the headers returned, the value of the `x-vcloud-authorization` header is your
75
- session token, and this will be valid for 30 minutes idle - any activity will extend
76
- its life by another 30 minutes.
77
-
78
- 3. Specify your credentials and session token at the beginning of the command. For example:
79
-
80
- FOG_CREDENTIAL=test_credentials \
81
- FOG_VCLOUD_TOKEN=AAAABBBBBCCCCCCDDDDDDEEEEEEFFFFF= \
82
- vcloud-launch node.yaml
83
-
84
- You may find it easier to export one or both of the values as environment variables.
85
-
86
- **NB** It is also possible to sidestep the need for the session token by saving your
87
- password in the fog file. This is **not recommended**.
54
+ Please see the [vcloud-tools usage documentation](http://gds-operations.github.io/vcloud-tools/usage/).
88
55
 
89
56
  ## Contributing
90
57
 
data/jenkins.sh CHANGED
@@ -1,16 +1,5 @@
1
- #!/bin/bash -x
1
+ #!/bin/bash
2
2
  set -e
3
3
 
4
- git clean -ffdx
5
-
6
- bundle install --path "${HOME}/bundles/${JOB_NAME}"
7
- bundle exec rake
8
-
9
- # Obtain the integration test parameters
10
- git clone git@github.gds:gds/vcloud-tools-testing-config.git
11
- mv vcloud-tools-testing-config/vcloud_tools_testing_config.yaml spec/integration/
12
- rm -rf vcloud-tools-testing-config
13
-
14
- RUBYOPT="-r ./tools/fog_credentials" bundle exec rake integration:all
15
-
4
+ ./jenkins_tests.sh
16
5
  bundle exec rake publish_gem
data/jenkins_tests.sh ADDED
@@ -0,0 +1,33 @@
1
+ #!/bin/bash
2
+ set -eu
3
+
4
+ function cleanup {
5
+ rm $FOG_RC
6
+ }
7
+
8
+ # Override default of ~/.fog and delete afterwards.
9
+ export FOG_RC=$(mktemp /tmp/vcloud_fog_rc.XXXXXXXXXX)
10
+ trap cleanup EXIT
11
+
12
+ cat <<EOF >${FOG_RC}
13
+ ${FOG_CREDENTIAL}:
14
+ vcloud_director_host: '${API_HOST}'
15
+ vcloud_director_username: '${API_USERNAME}'
16
+ vcloud_director_password: ''
17
+ EOF
18
+
19
+ git clean -ffdx
20
+
21
+ bundle install --path "${HOME}/bundles/${JOB_NAME}"
22
+ bundle exec rake
23
+
24
+ # Obtain the integration test parameters
25
+ git clone git@github.gds:gds/vcloud-tools-testing-config.git
26
+ mv vcloud-tools-testing-config/vcloud_tools_testing_config.yaml spec/integration/
27
+ rm -rf vcloud-tools-testing-config
28
+
29
+ # Never log token to STDOUT.
30
+ set +x
31
+ eval $(printenv API_PASSWORD | bundle exec vcloud-login)
32
+
33
+ bundle exec rake integration:all
@@ -18,7 +18,7 @@ module Vcloud
18
18
 
19
19
  network_names = extract_vm_networks(vapp_config)
20
20
  vapp = Vcloud::Core::Vapp.instantiate(name, network_names, template_id, vdc_name)
21
- Vcloud::Launcher::VmOrchestrator.new(vapp.fog_vms.first, vapp).customize(vapp_config[:vm]) if vapp_config[:vm]
21
+ Vcloud::Launcher::VmOrchestrator.new(vapp.vms.first, vapp).customize(vapp_config[:vm]) if vapp_config[:vm]
22
22
 
23
23
  vapp
24
24
  end
@@ -1,5 +1,5 @@
1
1
  module Vcloud
2
2
  module Launcher
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
@@ -2,8 +2,8 @@ module Vcloud
2
2
  module Launcher
3
3
  class VmOrchestrator
4
4
 
5
- def initialize fog_vm, vapp
6
- vm_id = fog_vm[:href].split('/').last
5
+ def initialize vcloud_vm, vapp
6
+ vm_id = vcloud_vm[:href].split('/').last
7
7
  @vm = Core::Vm.new(vm_id, vapp)
8
8
  end
9
9
 
@@ -10,13 +10,13 @@ describe Vcloud::Launcher::Launch do
10
10
  test_data_1 = define_test_data
11
11
  minimum_data_erb = File.join(File.dirname(__FILE__), 'data/minimum_data_setup.yaml.erb')
12
12
  @minimum_data_yaml = ErbHelper.convert_erb_template_to_yaml(test_data_1, minimum_data_erb)
13
- @fog_interface = Vcloud::Fog::ServiceInterface.new
13
+ @api_interface = Vcloud::Core::ApiInterface.new
14
14
 
15
15
  Vcloud::Launcher::Launch.new.run(@minimum_data_yaml, {"dont-power-on" => true})
16
16
 
17
- vapp_query_result = @fog_interface.get_vapp_by_name_and_vdc_name(test_data_1[:vapp_name], test_data_1[:vdc_name])
17
+ vapp_query_result = @api_interface.get_vapp_by_name_and_vdc_name(test_data_1[:vapp_name], test_data_1[:vdc_name])
18
18
  @provisioned_vapp_id = vapp_query_result[:href].split('/').last
19
- provisioned_vapp = @fog_interface.get_vapp @provisioned_vapp_id
19
+ provisioned_vapp = @api_interface.get_vapp @provisioned_vapp_id
20
20
 
21
21
  expect(provisioned_vapp).not_to be_nil
22
22
  expect(provisioned_vapp[:name]).to eq(test_data_1[:vapp_name])
@@ -26,7 +26,7 @@ describe Vcloud::Launcher::Launch do
26
26
  after(:each) do
27
27
  unless ENV['VCLOUD_TOOLS_RSPEC_NO_DELETE_VAPP']
28
28
  File.delete @minimum_data_yaml
29
- expect(@fog_interface.delete_vapp(@provisioned_vapp_id)).to eq(true)
29
+ expect(@api_interface.delete_vapp(@provisioned_vapp_id)).to eq(true)
30
30
  end
31
31
  end
32
32
  end
@@ -35,13 +35,13 @@ describe Vcloud::Launcher::Launch do
35
35
  before(:all) do
36
36
  @test_data = define_test_data
37
37
  @config_yaml = ErbHelper.convert_erb_template_to_yaml(@test_data, File.join(File.dirname(__FILE__), 'data/happy_path.yaml.erb'))
38
- @fog_interface = Vcloud::Fog::ServiceInterface.new
38
+ @api_interface = Vcloud::Core::ApiInterface.new
39
39
  Vcloud::Launcher::Launch.new.run(@config_yaml, { "dont-power-on" => true })
40
40
 
41
- @vapp_query_result = @fog_interface.get_vapp_by_name_and_vdc_name(@test_data[:vapp_name], @test_data[:vdc_name])
41
+ @vapp_query_result = @api_interface.get_vapp_by_name_and_vdc_name(@test_data[:vapp_name], @test_data[:vdc_name])
42
42
  @vapp_id = @vapp_query_result[:href].split('/').last
43
43
 
44
- @vapp = @fog_interface.get_vapp @vapp_id
44
+ @vapp = @api_interface.get_vapp @vapp_id
45
45
  @vm = @vapp[:Children][:Vm].first
46
46
  @vm_id = @vm[:href].split('/').last
47
47
 
@@ -120,7 +120,7 @@ describe Vcloud::Launcher::Launch do
120
120
  after(:all) do
121
121
  unless ENV['VCLOUD_TOOLS_RSPEC_NO_DELETE_VAPP']
122
122
  File.delete @config_yaml
123
- expect(@fog_interface.delete_vapp(@vapp_id)).to eq(true)
123
+ expect(@api_interface.delete_vapp(@vapp_id)).to eq(true)
124
124
  end
125
125
  end
126
126
 
@@ -6,22 +6,22 @@ describe Vcloud::Launcher::Launch do
6
6
  before(:all) do
7
7
  @test_data = define_test_data
8
8
  @config_yaml = ErbHelper.convert_erb_template_to_yaml(@test_data, File.join(File.dirname(__FILE__), 'data/storage_profile.yaml.erb'))
9
- @fog_interface = Vcloud::Fog::ServiceInterface.new
9
+ @api_interface = Vcloud::Core::ApiInterface.new
10
10
  Vcloud::Launcher::Launch.new.run(@config_yaml, {'dont-power-on' => true})
11
11
 
12
- @vapp_query_result_1 = @fog_interface.get_vapp_by_name_and_vdc_name(@test_data[:vapp_name_1], @test_data[:vdc_1_name])
12
+ @vapp_query_result_1 = @api_interface.get_vapp_by_name_and_vdc_name(@test_data[:vapp_name_1], @test_data[:vdc_1_name])
13
13
  @vapp_id_1 = @vapp_query_result_1[:href].split('/').last
14
- @vapp_1 = @fog_interface.get_vapp @vapp_id_1
14
+ @vapp_1 = @api_interface.get_vapp @vapp_id_1
15
15
  @vm_1 = @vapp_1[:Children][:Vm].first
16
16
 
17
- @vapp_query_result_2 = @fog_interface.get_vapp_by_name_and_vdc_name(@test_data[:vapp_name_2], @test_data[:vdc_2_name])
17
+ @vapp_query_result_2 = @api_interface.get_vapp_by_name_and_vdc_name(@test_data[:vapp_name_2], @test_data[:vdc_2_name])
18
18
  @vapp_id_2 = @vapp_query_result_2[:href].split('/').last
19
- @vapp_2 = @fog_interface.get_vapp @vapp_id_2
19
+ @vapp_2 = @api_interface.get_vapp @vapp_id_2
20
20
  @vm_2 = @vapp_2[:Children][:Vm].first
21
21
 
22
- @vapp_query_result_3 = @fog_interface.get_vapp_by_name_and_vdc_name(@test_data[:vapp_name_3], @test_data[:vdc_1_name])
22
+ @vapp_query_result_3 = @api_interface.get_vapp_by_name_and_vdc_name(@test_data[:vapp_name_3], @test_data[:vdc_1_name])
23
23
  @vapp_id_3 = @vapp_query_result_3[:href].split('/').last
24
- @vapp_3 = @fog_interface.get_vapp @vapp_id_3
24
+ @vapp_3 = @api_interface.get_vapp @vapp_id_3
25
25
  @vm_3 = @vapp_3[:Children][:Vm].first
26
26
 
27
27
  end
@@ -50,9 +50,9 @@ describe Vcloud::Launcher::Launch do
50
50
  after(:all) do
51
51
  unless ENV['VCLOUD_TOOLS_RSPEC_NO_DELETE_VAPP']
52
52
  File.delete @config_yaml
53
- expect(@fog_interface.delete_vapp(@vapp_id_1)).to eq(true)
54
- expect(@fog_interface.delete_vapp(@vapp_id_2)).to eq(true)
55
- expect(@fog_interface.delete_vapp(@vapp_id_3)).to eq(true)
53
+ expect(@api_interface.delete_vapp(@vapp_id_1)).to eq(true)
54
+ expect(@api_interface.delete_vapp(@vapp_id_2)).to eq(true)
55
+ expect(@api_interface.delete_vapp(@vapp_id_3)).to eq(true)
56
56
  end
57
57
  end
58
58
 
@@ -36,8 +36,8 @@ module Vcloud
36
36
  vars: { bob: 'Hello', mary: 'Hola' }
37
37
  },
38
38
  extra_disks: [
39
- { size: 5120, fs_file: '/opt/test_disk1' },
40
- { size: 10240, fs_file: '/opt/test_disk2' },
39
+ { name: 'test_disk1', size: 5120 },
40
+ { name: 'test_disk2', size: 10240 },
41
41
  ]
42
42
  }
43
43
  end
@@ -6,11 +6,11 @@ describe Vcloud::Launcher::VappOrchestrator do
6
6
 
7
7
  context "provision a vapp" do
8
8
 
9
- let(:mock_fog_vm) {
9
+ let(:mock_vcloud_vm) {
10
10
  double(:vm)
11
11
  }
12
12
  let(:mock_vapp) {
13
- double(:vapp, :fog_vms => [mock_fog_vm], :reload => self)
13
+ double(:vapp, :vms => [mock_vcloud_vm], :reload => self)
14
14
  }
15
15
  let(:mock_vm_orchestrator) {
16
16
  double(:vm_orchestrator, :customize => true)
@@ -46,7 +46,7 @@ describe Vcloud::Launcher::VappOrchestrator do
46
46
 
47
47
  expect(Vcloud::Core::Vapp).to receive(:instantiate).with('test-vapp-1', ['org-vdc-1-net-1'], 1, 'test-vdc-1')
48
48
  .and_return(mock_vapp)
49
- expect(Vcloud::Launcher::VmOrchestrator).to receive(:new).with(mock_fog_vm, mock_vapp).and_return(mock_vm_orchestrator)
49
+ expect(Vcloud::Launcher::VmOrchestrator).to receive(:new).with(mock_vcloud_vm, mock_vapp).and_return(mock_vm_orchestrator)
50
50
 
51
51
  new_vapp = subject.provision @config
52
52
  expect(new_vapp).to eq(mock_vapp)
@@ -6,14 +6,14 @@ describe Vcloud::Launcher::VmOrchestrator do
6
6
  @vm_id = "vm-12345678-1234-1234-1234-123456712312"
7
7
  end
8
8
 
9
- let(:fog_vm) {
9
+ let(:vcloud_vm) {
10
10
  { :href => "/#{@vm_id}" }
11
11
  }
12
12
  let(:vapp) {
13
13
  double(:vapp, :name => 'web-app1')
14
14
  }
15
15
  subject {
16
- Vcloud::Launcher::VmOrchestrator.new(fog_vm, vapp)
16
+ Vcloud::Launcher::VmOrchestrator.new(vcloud_vm, vapp)
17
17
  }
18
18
 
19
19
  it "orchestrates customization" do
@@ -26,10 +26,9 @@ describe Vcloud::Launcher::VmOrchestrator do
26
26
  :shutdown => true
27
27
  },
28
28
  :extra_disks => [
29
- {:size => '1024', :name => 'Hard disk 2', :fs_file => 'mysql', :fs_mntops => 'mysql-something'},
30
- {:size => '2048', :name => 'Hard disk 3', :fs_file => 'solr', :fs_mntops => 'solr-something'}
29
+ {:name => 'Hard disk 2', :size => '1024'},
30
+ {:name => 'Hard disk 3', :size => '2048'},
31
31
  ],
32
-
33
32
  :network_connections => [
34
33
  {:name => "network1", :ip_address => "198.12.1.21"},
35
34
  ],
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
 
21
21
  s.required_ruby_version = '>= 1.9.3'
22
22
 
23
- s.add_runtime_dependency 'vcloud-core', '~> 0.6.0'
23
+ s.add_runtime_dependency 'vcloud-core', '~> 0.9.0'
24
24
  s.add_development_dependency 'gem_publisher', '1.2.0'
25
25
  s.add_development_dependency 'pry'
26
26
  s.add_development_dependency 'rake'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vcloud-launcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
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-07-15 00:00:00.000000000 Z
12
+ date: 2014-08-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: vcloud-core
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 0.6.0
21
+ version: 0.9.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 0.6.0
29
+ version: 0.9.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: gem_publisher
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -162,7 +162,7 @@ files:
162
162
  - examples/vcloud-launch/multiple_vapps_simple.yaml
163
163
  - examples/vcloud-launch/yaml_anchors_example.yaml
164
164
  - jenkins.sh
165
- - jenkins_integration_tests.sh
165
+ - jenkins_tests.sh
166
166
  - lib/vcloud/launcher.rb
167
167
  - lib/vcloud/launcher/cli.rb
168
168
  - lib/vcloud/launcher/launch.rb
@@ -189,7 +189,6 @@ files:
189
189
  - spec/vcloud/launcher/preamble_spec.rb
190
190
  - spec/vcloud/launcher/vapp_orchestrator_spec.rb
191
191
  - spec/vcloud/launcher/vm_orchestrator_spec.rb
192
- - tools/fog_credentials.rb
193
192
  - vcloud-launcher.gemspec
194
193
  homepage: https://github.com/gds-operations/vcloud-launcher
195
194
  licenses:
@@ -212,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
211
  version: '0'
213
212
  segments:
214
213
  - 0
215
- hash: -851694776577848026
214
+ hash: -4262802596274003381
216
215
  requirements: []
217
216
  rubyforge_project:
218
217
  rubygems_version: 1.8.23
@@ -1,13 +0,0 @@
1
- #!/bin/bash -x
2
- set -e
3
-
4
- git clean -ffdx
5
-
6
- bundle install --path "${HOME}/bundles/${JOB_NAME}"
7
-
8
- # Obtain the integration test parameters
9
- git clone git@github.gds:gds/vcloud-tools-testing-config.git
10
- mv vcloud-tools-testing-config/vcloud_tools_testing_config.yaml spec/integration/
11
- rm -rf vcloud-tools-testing-config
12
-
13
- RUBYOPT="-r ./tools/fog_credentials" bundle exec rake integration:all
@@ -1,17 +0,0 @@
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
- }