vcloud-launcher 0.0.4 → 0.0.5
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/.travis.yml +9 -0
- data/CHANGELOG.md +6 -0
- data/README.md +9 -7
- data/Rakefile +7 -2
- data/bin/vcloud-launch +2 -0
- data/features/step_definitions/vcloud-launch_steps.rb +1 -1
- data/features/vcloud-launch.feature +2 -0
- data/lib/vcloud/launcher.rb +0 -4
- data/lib/vcloud/launcher/launch.rb +15 -6
- data/lib/vcloud/launcher/vapp_orchestrator.rb +12 -9
- data/lib/vcloud/launcher/version.rb +1 -1
- data/lib/vcloud/launcher/vm_orchestrator.rb +3 -3
- data/spec/integration/launcher/storage_profile_integration_spec.rb +19 -19
- data/spec/integration/launcher/vcloud_launcher_spec.rb +24 -24
- data/spec/spec_helper.rb +0 -1
- data/spec/vcloud/launcher/launch_spec.rb +64 -36
- data/spec/vcloud/launcher/vapp_orchestrator_spec.rb +1 -6
- data/vcloud-launcher.gemspec +2 -1
- metadata +22 -8
- data/examples/.fog-example.fog +0 -15
- data/spec/support/stub_fog_interface.rb +0 -59
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -112,15 +112,17 @@ If you want to be sure you are pinning to 5.1, or use 5.5, you can set the API v
|
|
112
112
|
|
113
113
|
## Testing
|
114
114
|
|
115
|
-
|
116
|
-
Runs the unit and feature tests (pretty quick right now)
|
115
|
+
Run the default suite of tests (e.g. lint, unit, features):
|
117
116
|
|
118
|
-
|
119
|
-
* Feature tests only: `bundle exec rake features`
|
120
|
-
* Integration tests ('quick' tests): `bundle exec rake integration:quick`
|
121
|
-
* Integration tests (all tests - takes 20mins+): `bundle exec rake integration:all`
|
117
|
+
bundle exec rake
|
122
118
|
|
123
|
-
|
119
|
+
Run the integration tests (slower and requires a real environment):
|
120
|
+
|
121
|
+
bundle exec rake integration
|
122
|
+
|
123
|
+
Run the integration tests minus some that are very slow:
|
124
|
+
|
125
|
+
bundle exec rake integration:quick
|
124
126
|
|
125
127
|
You need access to a suitable vCloud Director organization to run the
|
126
128
|
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 => [:spec
|
5
|
+
task :default => [:rubocop, :spec, :features]
|
6
6
|
task :integration => ['integration:all']
|
7
7
|
|
8
8
|
RSpec::Core::RakeTask.new(:spec) do |task|
|
@@ -27,7 +27,12 @@ RSpec::Core::RakeTask.new('integration:all') do |t|
|
|
27
27
|
t.pattern = FileList['spec/integration/**/*_spec.rb']
|
28
28
|
end
|
29
29
|
|
30
|
-
task :publish_gem do
|
30
|
+
task :publish_gem do
|
31
31
|
gem = GemPublisher.publish_if_updated("vcloud-launcher.gemspec", :rubygems)
|
32
32
|
puts "Published #{gem}" if gem
|
33
33
|
end
|
34
|
+
|
35
|
+
require 'rubocop/rake_task'
|
36
|
+
Rubocop::RakeTask.new(:rubocop) do |task|
|
37
|
+
task.options = ['--lint']
|
38
|
+
end
|
data/bin/vcloud-launch
CHANGED
@@ -17,6 +17,8 @@ class App
|
|
17
17
|
|
18
18
|
on("-x", "--dont-power-on", "Do not power on vApps (default is to power on)")
|
19
19
|
on("-c", "--continue-on-error", "Continue on error ( default is false) ")
|
20
|
+
on("-q", "--quiet", "Quiet output - only report errors")
|
21
|
+
on("-v", "--verbose", "Verbose output")
|
20
22
|
|
21
23
|
arg :org_config_file
|
22
24
|
|
data/lib/vcloud/launcher.rb
CHANGED
@@ -7,19 +7,17 @@ module Vcloud
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def run(config_file = nil, cli_options = {})
|
10
|
+
set_logging_level(cli_options)
|
10
11
|
config = @config_loader.load_config(config_file, config_schema)
|
11
12
|
config[:vapps].each do |vapp_config|
|
12
|
-
Vcloud::
|
13
|
-
Vcloud::Launcher.logger.info("Provisioning vApp #{vapp_config[:name]}.")
|
13
|
+
Vcloud::Core.logger.info("Provisioning vApp #{vapp_config[:name]}.")
|
14
14
|
begin
|
15
15
|
vapp = ::Vcloud::Launcher::VappOrchestrator.provision(vapp_config)
|
16
16
|
#methadone sends option starting with 'no' as false.
|
17
17
|
vapp.power_on unless cli_options["dont-power-on"]
|
18
|
-
Vcloud::
|
19
|
-
Vcloud::Launcher.logger.info("=" * 70)
|
18
|
+
Vcloud::Core.logger.info("Provisioned vApp #{vapp_config[:name]} successfully.")
|
20
19
|
rescue RuntimeError => e
|
21
|
-
Vcloud::
|
22
|
-
Vcloud::Launcher.logger.info("=" * 70)
|
20
|
+
Vcloud::Core.logger.error("Failure: Could not provision vApp: #{e.message}")
|
23
21
|
break unless cli_options["continue-on-error"]
|
24
22
|
end
|
25
23
|
|
@@ -41,6 +39,17 @@ module Vcloud
|
|
41
39
|
}
|
42
40
|
}
|
43
41
|
end
|
42
|
+
|
43
|
+
def set_logging_level(cli_options)
|
44
|
+
if cli_options[:verbose]
|
45
|
+
Vcloud::Core.logger.level = Logger::DEBUG
|
46
|
+
elsif cli_options[:quiet]
|
47
|
+
Vcloud::Core.logger.level = Logger::ERROR
|
48
|
+
else
|
49
|
+
Vcloud::Core.logger.level = Logger::INFO
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
44
53
|
end
|
45
54
|
end
|
46
55
|
end
|
@@ -5,16 +5,19 @@ module Vcloud
|
|
5
5
|
def self.provision(vapp_config)
|
6
6
|
name, vdc_name = vapp_config[:name], vapp_config[:vdc_name]
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
template_id = template.id
|
13
|
-
|
14
|
-
network_names = extract_vm_networks(vapp_config)
|
15
|
-
vapp = Vcloud::Core::Vapp.instantiate(name, network_names, template_id, vdc_name)
|
16
|
-
Vcloud::Launcher::VmOrchestrator.new(vapp.fog_vms.first, vapp).customize(vapp_config[:vm]) if vapp_config[:vm]
|
8
|
+
vapp_existing = Vcloud::Core::Vapp.get_by_name_and_vdc_name(name, vdc_name)
|
9
|
+
if vapp_existing
|
10
|
+
Vcloud::Core.logger.info("Found existing vApp #{name} in vDC '#{vdc_name}'. Skipping.")
|
11
|
+
return vapp_existing
|
17
12
|
end
|
13
|
+
|
14
|
+
template = Vcloud::Core::VappTemplate.get(vapp_config[:catalog], vapp_config[:catalog_item])
|
15
|
+
template_id = template.id
|
16
|
+
|
17
|
+
network_names = extract_vm_networks(vapp_config)
|
18
|
+
vapp = Vcloud::Core::Vapp.instantiate(name, network_names, template_id, vdc_name)
|
19
|
+
Vcloud::Launcher::VmOrchestrator.new(vapp.fog_vms.first, vapp).customize(vapp_config[:vm]) if vapp_config[:vm]
|
20
|
+
|
18
21
|
vapp
|
19
22
|
end
|
20
23
|
|
@@ -10,9 +10,9 @@ module Vcloud
|
|
10
10
|
@vm.update_name(@vm.vapp_name)
|
11
11
|
@vm.configure_network_interfaces vm_config[:network_connections]
|
12
12
|
@vm.update_storage_profile(vm_config[:storage_profile]) if vm_config[:storage_profile]
|
13
|
-
if
|
14
|
-
@vm.update_cpu_count(hardware_config[:cpu])
|
15
|
-
@vm.update_memory_size_in_mb(hardware_config[:memory])
|
13
|
+
if vm_config[:hardware_config]
|
14
|
+
@vm.update_cpu_count(vm_config[:hardware_config][:cpu])
|
15
|
+
@vm.update_memory_size_in_mb(vm_config[:hardware_config][:memory])
|
16
16
|
end
|
17
17
|
@vm.add_extra_disks(vm_config[:extra_disks])
|
18
18
|
@vm.update_metadata(vm_config[:metadata])
|
@@ -30,51 +30,51 @@ describe Vcloud::Launcher::Launch do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "vdc 1 should have a storage profile without the href being specified" do
|
33
|
-
|
33
|
+
@vm_1[:StorageProfile][:name].should eq(@test_data[:storage_profile])
|
34
34
|
end
|
35
35
|
|
36
36
|
it "vdc 1's storage profile should have the expected href" do
|
37
|
-
|
37
|
+
@vm_1[:StorageProfile][:href].should eq(@test_data[:vdc_1_sp_href])
|
38
38
|
end
|
39
39
|
|
40
40
|
it "vdc 2 should have the same named storage profile as vdc 1" do
|
41
|
-
|
41
|
+
@vm_2[:StorageProfile][:name].should eq(@test_data[:storage_profile])
|
42
42
|
end
|
43
43
|
|
44
44
|
it "the storage profile in vdc 2 should have a different href to the storage profile in vdc 1" do
|
45
|
-
|
45
|
+
@vm_2[:StorageProfile][:href].should eq(@test_data[:vdc_2_sp_href])
|
46
46
|
end
|
47
47
|
|
48
48
|
it "when a storage profile is not specified, vm uses the default and continues" do
|
49
|
-
|
50
|
-
|
49
|
+
@vm_3[:StorageProfile][:name].should eq(@test_data[:default_storage_profile_name])
|
50
|
+
@vm_3[:StorageProfile][:href].should eq(@test_data[:default_storage_profile_href])
|
51
51
|
end
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
it "when a storage profile is not specified, customize continues with other customizations" do
|
54
|
+
@vm_3_id = @vm_3[:href].split('/').last
|
55
|
+
@vm_3_metadata = Vcloud::Core::Vm.get_metadata @vm_3_id
|
56
|
+
@vm_3_metadata[:storage_profile_test_vm].should eq(true)
|
57
57
|
end
|
58
58
|
|
59
59
|
it "when a storage profile specified does not exist, vm uses the default" do
|
60
|
-
|
61
|
-
|
60
|
+
@vm_4[:StorageProfile][:name].should eq(@test_data[:default_storage_profile_name])
|
61
|
+
@vm_4[:StorageProfile][:href].should eq(@test_data[:default_storage_profile_href])
|
62
62
|
end
|
63
63
|
|
64
64
|
# This is a bug - if it has failed customization it should let the user know
|
65
65
|
it "when storage profile specified doesn't exist, it errors and continues" do
|
66
|
-
|
67
|
-
|
68
|
-
|
66
|
+
@vm_4_id = @vm_4[:href].split('/').last
|
67
|
+
@vm_4_metadata = Vcloud::Core::Vm.get_metadata @vm_4_id
|
68
|
+
@vm_4_metadata[:storage_profile_test_vm].should be_nil
|
69
69
|
end
|
70
70
|
|
71
71
|
after(:all) do
|
72
72
|
unless ENV['VCLOUD_TOOLS_RSPEC_NO_DELETE_VAPP']
|
73
73
|
File.delete @config_yaml
|
74
|
-
@fog_interface.delete_vapp(@vapp_id_1).should
|
75
|
-
@fog_interface.delete_vapp(@vapp_id_2).should
|
76
|
-
@fog_interface.delete_vapp(@vapp_id_3).should
|
77
|
-
@fog_interface.delete_vapp(@vapp_id_4).should
|
74
|
+
@fog_interface.delete_vapp(@vapp_id_1).should eq(true)
|
75
|
+
@fog_interface.delete_vapp(@vapp_id_2).should eq(true)
|
76
|
+
@fog_interface.delete_vapp(@vapp_id_3).should eq(true)
|
77
|
+
@fog_interface.delete_vapp(@vapp_id_4).should eq(true)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -18,14 +18,14 @@ describe Vcloud::Launcher::Launch do
|
|
18
18
|
provisioned_vapp = @fog_interface.get_vapp @provisioned_vapp_id
|
19
19
|
|
20
20
|
provisioned_vapp.should_not be_nil
|
21
|
-
provisioned_vapp[:name].should
|
22
|
-
provisioned_vapp[:Children][:Vm].count.should
|
21
|
+
provisioned_vapp[:name].should eq(test_data_1[:vapp_name])
|
22
|
+
provisioned_vapp[:Children][:Vm].count.should eq(1)
|
23
23
|
end
|
24
24
|
|
25
25
|
after(:each) do
|
26
26
|
unless ENV['VCLOUD_TOOLS_RSPEC_NO_DELETE_VAPP']
|
27
27
|
File.delete @minimum_data_yaml
|
28
|
-
@fog_interface.delete_vapp(@provisioned_vapp_id).should
|
28
|
+
@fog_interface.delete_vapp(@provisioned_vapp_id).should eq(true)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -49,8 +49,8 @@ describe Vcloud::Launcher::Launch do
|
|
49
49
|
|
50
50
|
context 'provision vapp' do
|
51
51
|
it 'should create a vapp' do
|
52
|
-
@vapp[:name].should
|
53
|
-
@vapp[:'ovf:NetworkSection'][:'ovf:Network'].count.should
|
52
|
+
@vapp[:name].should eq(@test_data[:vapp_name])
|
53
|
+
@vapp[:'ovf:NetworkSection'][:'ovf:Network'].count.should eq(2)
|
54
54
|
vapp_networks = @vapp[:'ovf:NetworkSection'][:'ovf:Network'].collect { |connection| connection[:ovf_name] }
|
55
55
|
vapp_networks.should =~ [@test_data[:network1], @test_data[:network2]]
|
56
56
|
end
|
@@ -63,23 +63,23 @@ describe Vcloud::Launcher::Launch do
|
|
63
63
|
|
64
64
|
context "customize vm" do
|
65
65
|
it "change cpu for given vm" do
|
66
|
-
extract_memory(@vm).should
|
67
|
-
extract_cpu(@vm).should
|
66
|
+
extract_memory(@vm).should eq('8192')
|
67
|
+
extract_cpu(@vm).should eq('4')
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should have added the right number of metadata values" do
|
71
|
-
@vm_metadata.count.should
|
71
|
+
@vm_metadata.count.should eq(6)
|
72
72
|
end
|
73
73
|
|
74
74
|
it "the metadata should be equivalent to our input" do
|
75
|
-
@vm_metadata[:is_true].should
|
76
|
-
@vm_metadata[:is_integer].should
|
77
|
-
@vm_metadata[:is_string].should
|
75
|
+
@vm_metadata[:is_true].should eq(true)
|
76
|
+
@vm_metadata[:is_integer].should eq(-999)
|
77
|
+
@vm_metadata[:is_string].should eq('Hello World')
|
78
78
|
end
|
79
79
|
|
80
80
|
it "should attach extra hard disks to vm" do
|
81
81
|
disks = extract_disks(@vm)
|
82
|
-
disks.count.should
|
82
|
+
disks.count.should eq(3)
|
83
83
|
[{:name => 'Hard disk 2', :size => '1024'}, {:name => 'Hard disk 3', :size => '2048'}].each do |new_disk|
|
84
84
|
disks.should include(new_disk)
|
85
85
|
end
|
@@ -88,30 +88,30 @@ describe Vcloud::Launcher::Launch do
|
|
88
88
|
it "should configure the vm network interface" do
|
89
89
|
vm_network_connection = @vm[:NetworkConnectionSection][:NetworkConnection]
|
90
90
|
vm_network_connection.should_not be_nil
|
91
|
-
vm_network_connection.count.should
|
91
|
+
vm_network_connection.count.should eq(2)
|
92
92
|
|
93
93
|
|
94
94
|
primary_nic = vm_network_connection.detect { |connection| connection[:network] == @test_data[:network1] }
|
95
|
-
primary_nic[:network].should
|
96
|
-
primary_nic[:NetworkConnectionIndex].should
|
97
|
-
primary_nic[:IpAddress].should
|
98
|
-
primary_nic[:IpAddressAllocationMode].should
|
95
|
+
primary_nic[:network].should eq(@test_data[:network1])
|
96
|
+
primary_nic[:NetworkConnectionIndex].should eq(@vm[:NetworkConnectionSection][:PrimaryNetworkConnectionIndex])
|
97
|
+
primary_nic[:IpAddress].should eq(@test_data[:network1_ip])
|
98
|
+
primary_nic[:IpAddressAllocationMode].should eq('MANUAL')
|
99
99
|
|
100
100
|
second_nic = vm_network_connection.detect { |connection| connection[:network] == @test_data[:network2] }
|
101
|
-
second_nic[:network].should
|
102
|
-
second_nic[:NetworkConnectionIndex].should
|
103
|
-
second_nic[:IpAddress].should
|
104
|
-
second_nic[:IpAddressAllocationMode].should
|
101
|
+
second_nic[:network].should eq(@test_data[:network2])
|
102
|
+
second_nic[:NetworkConnectionIndex].should eq('1')
|
103
|
+
second_nic[:IpAddress].should eq(@test_data[:network2_ip])
|
104
|
+
second_nic[:IpAddressAllocationMode].should eq('MANUAL')
|
105
105
|
|
106
106
|
end
|
107
107
|
|
108
108
|
it 'should assign guest customization script to the VM' do
|
109
109
|
@vm[:GuestCustomizationSection][:CustomizationScript].should =~ /message: hello world/
|
110
|
-
@vm[:GuestCustomizationSection][:ComputerName].should
|
110
|
+
@vm[:GuestCustomizationSection][:ComputerName].should eq(@test_data[:vapp_name])
|
111
111
|
end
|
112
112
|
|
113
113
|
it "should assign storage profile to the VM" do
|
114
|
-
@vm[:StorageProfile][:name].should
|
114
|
+
@vm[:StorageProfile][:name].should eq(@test_data[:storage_profile])
|
115
115
|
end
|
116
116
|
|
117
117
|
end
|
@@ -119,7 +119,7 @@ describe Vcloud::Launcher::Launch do
|
|
119
119
|
after(:all) do
|
120
120
|
unless ENV['VCLOUD_TOOLS_RSPEC_NO_DELETE_VAPP']
|
121
121
|
File.delete @config_yaml
|
122
|
-
@fog_interface.delete_vapp(@vapp_id).should
|
122
|
+
@fog_interface.delete_vapp(@vapp_id).should eq(true)
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
data/spec/spec_helper.rb
CHANGED
@@ -2,47 +2,75 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Vcloud
|
4
4
|
describe Launcher::Launch do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
5
|
+
context "#run" do
|
6
|
+
before(:each) do
|
7
|
+
config_loader = double(:config_loader)
|
8
|
+
expect(Vcloud::Core::ConfigLoader).to receive(:new).and_return(config_loader)
|
9
|
+
@successful_app_1 = {
|
10
|
+
:name => "successful app 1",
|
11
|
+
:vdc_name => "Test Vdc",
|
12
|
+
:catalog => "default",
|
13
|
+
:catalog_item => "ubuntu-precise"
|
14
|
+
}
|
15
|
+
@fake_failing_app = {
|
16
|
+
:name => "fake failing app",
|
17
|
+
:vdc_name => "wrong vdc",
|
18
|
+
:catalog => "default",
|
19
|
+
:catalog_item => "ubuntu-precise"
|
20
|
+
}
|
21
|
+
@successful_app_2 = {
|
22
|
+
:name => "successful app 2",
|
23
|
+
:vdc_name => "Test Vdc",
|
24
|
+
:catalog => "default",
|
25
|
+
:catalog_item => "ubuntu-precise"
|
26
|
+
}
|
27
|
+
expect(config_loader).to receive(:load_config).
|
28
|
+
and_return({:vapps => [@successful_app_1, @fake_failing_app, @successful_app_2]})
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should stop on failure by default" do
|
32
|
+
expect(Vcloud::Launcher::VappOrchestrator).to receive(:provision).with(@successful_app_1).and_return(double(:vapp, :power_on => true))
|
33
|
+
expect(Vcloud::Launcher::VappOrchestrator).to receive(:provision).with(@fake_failing_app).and_raise(RuntimeError.new('failed to find vdc'))
|
34
|
+
expect(Vcloud::Launcher::VappOrchestrator).not_to receive(:provision).with(@successful_app_2)
|
35
|
+
|
36
|
+
cli_options = {}
|
37
|
+
Vcloud::Launcher::Launch.new.run('input_config_yaml', cli_options)
|
38
|
+
end
|
29
39
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
40
|
+
it "should continue on error if cli option continue-on-error is set" do
|
41
|
+
expect(Vcloud::Launcher::VappOrchestrator).to receive(:provision).with(@successful_app_1).and_return(double(:vapp, :power_on => true))
|
42
|
+
expect(Vcloud::Launcher::VappOrchestrator).to receive(:provision).with(@fake_failing_app).and_raise(RuntimeError.new('failed to find vdc'))
|
43
|
+
expect(Vcloud::Launcher::VappOrchestrator).to receive(:provision).with(@successful_app_2).and_return(double(:vapp, :power_on => true))
|
44
|
+
|
45
|
+
cli_options = {"continue-on-error" => true}
|
46
|
+
Vcloud::Launcher::Launch.new.run('input_config_yaml', cli_options)
|
47
|
+
end
|
34
48
|
|
35
|
-
cli_options = {}
|
36
|
-
Vcloud::Launcher::Launch.new.run('input_config_yaml', cli_options)
|
37
49
|
end
|
38
50
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
51
|
+
context "#set_logging_level" do
|
52
|
+
|
53
|
+
it "sets the logging level to DEBUG when :verbose is specified" do
|
54
|
+
expect(Vcloud::Core.logger).to receive(:level=).with(Logger::DEBUG)
|
55
|
+
Vcloud::Launcher::Launch.new.set_logging_level(:verbose => true)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "sets the logging level to ERROR when :quiet is specified" do
|
59
|
+
expect(Vcloud::Core.logger).to receive(:level=).with(Logger::ERROR)
|
60
|
+
Vcloud::Launcher::Launch.new.set_logging_level(:quiet => true)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "sets the logging level to DEBUG when :quiet and :verbose are specified" do
|
64
|
+
expect(Vcloud::Core.logger).to receive(:level=).with(Logger::DEBUG)
|
65
|
+
Vcloud::Launcher::Launch.new.set_logging_level(:quiet => true, :verbose => true)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "sets the logging level to INFO by default" do
|
69
|
+
expect(Vcloud::Core.logger).to receive(:level=).with(Logger::INFO)
|
70
|
+
Vcloud::Launcher::Launch.new.set_logging_level({})
|
71
|
+
end
|
43
72
|
|
44
|
-
cli_options = {"continue-on-error" => true}
|
45
|
-
Vcloud::Launcher::Launch.new.run('input_config_yaml', cli_options)
|
46
73
|
end
|
74
|
+
|
47
75
|
end
|
48
76
|
end
|
@@ -4,11 +4,6 @@ module Vcloud
|
|
4
4
|
module Launcher
|
5
5
|
describe VappOrchestrator do
|
6
6
|
|
7
|
-
before(:each) do
|
8
|
-
@mock_fog_interface = StubFogInterface.new
|
9
|
-
Vcloud::Fog::ServiceInterface.stub(:new).and_return(@mock_fog_interface)
|
10
|
-
end
|
11
|
-
|
12
7
|
context "provision a vapp" do
|
13
8
|
|
14
9
|
before(:each) do
|
@@ -27,7 +22,7 @@ module Vcloud
|
|
27
22
|
existing_vapp = double(:vapp, :name => 'existing-vapp-1')
|
28
23
|
|
29
24
|
Core::Vapp.should_receive(:get_by_name_and_vdc_name).with('test-vapp-1', 'test-vdc-1').and_return(existing_vapp)
|
30
|
-
Vcloud::
|
25
|
+
Vcloud::Core.logger.should_receive(:info).with('Found existing vApp test-vapp-1 in vDC \'test-vdc-1\'. Skipping.')
|
31
26
|
actual_vapp = VappOrchestrator.provision @config
|
32
27
|
actual_vapp.should_not be_nil
|
33
28
|
actual_vapp.should == existing_vapp
|
data/vcloud-launcher.gemspec
CHANGED
@@ -21,10 +21,11 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.required_ruby_version = '>= 1.9.2'
|
22
22
|
|
23
23
|
s.add_runtime_dependency 'methadone'
|
24
|
-
s.add_runtime_dependency 'vcloud-core', '~> 0.0
|
24
|
+
s.add_runtime_dependency 'vcloud-core', '~> 0.3.0'
|
25
25
|
s.add_development_dependency 'aruba', '~> 0.5.3'
|
26
26
|
s.add_development_dependency 'cucumber', '~> 1.3.10'
|
27
27
|
s.add_development_dependency 'gem_publisher', '1.2.0'
|
28
28
|
s.add_development_dependency 'rake'
|
29
29
|
s.add_development_dependency 'rspec', '~> 2.14.1'
|
30
|
+
s.add_development_dependency 'rubocop'
|
30
31
|
end
|
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.0.
|
4
|
+
version: 0.0.5
|
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-05-
|
12
|
+
date: 2014-05-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: methadone
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 0.0
|
37
|
+
version: 0.3.0
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.0
|
45
|
+
version: 0.3.0
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: aruba
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,6 +123,22 @@ dependencies:
|
|
123
123
|
- - ~>
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: 2.14.1
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rubocop
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
126
142
|
description:
|
127
143
|
email:
|
128
144
|
- anna.shipman@digital.cabinet-office.gov.uk
|
@@ -132,13 +148,13 @@ extensions: []
|
|
132
148
|
extra_rdoc_files: []
|
133
149
|
files:
|
134
150
|
- .gitignore
|
151
|
+
- .travis.yml
|
135
152
|
- CHANGELOG.md
|
136
153
|
- Gemfile
|
137
154
|
- LICENSE.txt
|
138
155
|
- README.md
|
139
156
|
- Rakefile
|
140
157
|
- bin/vcloud-launch
|
141
|
-
- examples/.fog-example.fog
|
142
158
|
- examples/vcloud-launch/basic_preamble.erb
|
143
159
|
- examples/vcloud-launch/complete_vapp_config.yaml
|
144
160
|
- examples/vcloud-launch/minimal_vapp_config.yaml
|
@@ -163,7 +179,6 @@ files:
|
|
163
179
|
- spec/integration/launcher/storage_profile_integration_spec.rb
|
164
180
|
- spec/integration/launcher/vcloud_launcher_spec.rb
|
165
181
|
- spec/spec_helper.rb
|
166
|
-
- spec/support/stub_fog_interface.rb
|
167
182
|
- spec/vcloud/launcher/launch_spec.rb
|
168
183
|
- spec/vcloud/launcher/vapp_orchestrator_spec.rb
|
169
184
|
- spec/vcloud/launcher/vm_orchestrator_spec.rb
|
@@ -190,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
205
|
version: '0'
|
191
206
|
segments:
|
192
207
|
- 0
|
193
|
-
hash: -
|
208
|
+
hash: -774261046686009457
|
194
209
|
requirements: []
|
195
210
|
rubyforge_project:
|
196
211
|
rubygems_version: 1.8.23
|
@@ -209,7 +224,6 @@ test_files:
|
|
209
224
|
- spec/integration/launcher/storage_profile_integration_spec.rb
|
210
225
|
- spec/integration/launcher/vcloud_launcher_spec.rb
|
211
226
|
- spec/spec_helper.rb
|
212
|
-
- spec/support/stub_fog_interface.rb
|
213
227
|
- spec/vcloud/launcher/launch_spec.rb
|
214
228
|
- spec/vcloud/launcher/vapp_orchestrator_spec.rb
|
215
229
|
- spec/vcloud/launcher/vm_orchestrator_spec.rb
|
data/examples/.fog-example.fog
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
p1-production:
|
2
|
-
vcloud_director_username: '<username_from_top_right_of_skyscape_flash_ui>@<org_id_from_url_in_skyscape_flash_ui>'
|
3
|
-
vcloud_director_password: '<your_skyscape_password>'
|
4
|
-
vcloud_director_host: 'vcd.portal.skyscapecloud.com'
|
5
|
-
|
6
|
-
# You can extract this information by logging into skyscape portal
|
7
|
-
performance-platform-production:
|
8
|
-
vcloud_director_username: '<xxx.x.xxxxxx>@<x-x-xx-xxxxxx>'
|
9
|
-
vcloud_director_password: '<your_skyscape_password>'
|
10
|
-
vcloud_director_host: 'vcd.portal.skyscapecloud.com'
|
11
|
-
|
12
|
-
carrenza-preview:
|
13
|
-
vcloud_director_username: '<email>@<org_id>'
|
14
|
-
vcloud_director_password: ''
|
15
|
-
vcloud_director_host: 'myvdc.carrenza.net'
|
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'ostruct'
|
2
|
-
|
3
|
-
class StubFogInterface
|
4
|
-
|
5
|
-
def name
|
6
|
-
'Test vDC 1'
|
7
|
-
end
|
8
|
-
|
9
|
-
def vdc_object_by_name(vdc_name)
|
10
|
-
vdc = OpenStruct.new
|
11
|
-
vdc.name = 'test-vdc-1'
|
12
|
-
vdc
|
13
|
-
end
|
14
|
-
|
15
|
-
def template
|
16
|
-
{ :href => '/vappTemplate-12345678-90ab-cdef-0123-4567890abcde' }
|
17
|
-
end
|
18
|
-
|
19
|
-
def find_networks(network_names, vdc_name)
|
20
|
-
[{
|
21
|
-
:name => 'org-vdc-1-net-1',
|
22
|
-
:href => '/org-vdc-1-net-1-id',
|
23
|
-
}]
|
24
|
-
end
|
25
|
-
|
26
|
-
def get_vapp(id)
|
27
|
-
{ :name => 'test-vapp-1' }
|
28
|
-
end
|
29
|
-
|
30
|
-
def get_edge_gateway(id)
|
31
|
-
{
|
32
|
-
:name => 'test-edgegw-1',
|
33
|
-
:href => "/#{id}",
|
34
|
-
}
|
35
|
-
end
|
36
|
-
|
37
|
-
def vdc(name)
|
38
|
-
{ }
|
39
|
-
end
|
40
|
-
|
41
|
-
def post_instantiate_vapp_template(vdc, template, name, params)
|
42
|
-
{
|
43
|
-
:href => '/test-vapp-1-id',
|
44
|
-
:Children => {
|
45
|
-
:Vm => ['bogus vm data']
|
46
|
-
}
|
47
|
-
}
|
48
|
-
end
|
49
|
-
|
50
|
-
def get_vapp_by_vdc_and_name
|
51
|
-
{ }
|
52
|
-
end
|
53
|
-
|
54
|
-
def template(catalog_name, name)
|
55
|
-
{ :href => '/vappTemplate-12345678-90ab-cdef-0123-4567890abcde' }
|
56
|
-
end
|
57
|
-
|
58
|
-
|
59
|
-
end
|