vcloud-launcher 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ ---
2
+ language: ruby
3
+ rvm:
4
+ - 1.9.3
5
+ branches:
6
+ except:
7
+ - master
8
+ notifications:
9
+ email: false
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.0.5 (2014-05-14)
2
+
3
+ Features:
4
+
5
+ - Add '--quiet' and '--verbose' options. Default now only shows major operations and progress bar.
6
+
1
7
  ## 0.0.4 (2014-05-01)
2
8
 
3
9
  - Use pessimistic version dependency for vcloud-core
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
- Default target: `bundle exec rake`
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
- * Unit tests only: `bundle exec rake spec`
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
- NB. `bundle exec rake integration` is an alias for `bundle exec rake integration:all`.
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,:features]
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 |t|
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
 
@@ -1,3 +1,3 @@
1
- Then(/^the banner should document that this app takes (\d+) argument$/) do |arg1|
1
+ Then(/^the banner should document that this app takes (\d+) argument$/) do
2
2
  pending # express the regexp above with the code you wish you had
3
3
  end
@@ -12,5 +12,7 @@ Feature: "vcloud-launch" works as a useful command-line tool
12
12
  |--version|
13
13
  |--dont-power-on|
14
14
  |--continue-on-error|
15
+ |--verbose|
16
+ |--quiet|
15
17
  And the banner should document that this app's arguments are:
16
18
  |org_config_file|
@@ -10,10 +10,6 @@ require 'vcloud/launcher/version'
10
10
  module Vcloud
11
11
  module Launcher
12
12
 
13
- def self.logger
14
- @logger ||= Logger.new(STDOUT)
15
- end
16
-
17
13
  def self.clone_object object
18
14
  Marshal.load(Marshal.dump(object))
19
15
  end
@@ -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::Launcher.logger.info("\n")
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::Launcher.logger.info("Done! Provisioned vApp #{vapp_config[:name]} successfully.")
19
- Vcloud::Launcher.logger.info("=" * 70)
18
+ Vcloud::Core.logger.info("Provisioned vApp #{vapp_config[:name]} successfully.")
20
19
  rescue RuntimeError => e
21
- Vcloud::Launcher.logger.error("Failure : Could not provision vApp: #{e.message}")
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
- if vapp = Vcloud::Core::Vapp.get_by_name_and_vdc_name(name, vdc_name)
9
- Vcloud::Launcher.logger.info("Found existing vApp #{name} in vDC '#{vdc_name}'. Skipping.")
10
- else
11
- template = Vcloud::Core::VappTemplate.get(vapp_config[:catalog], vapp_config[:catalog_item])
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
 
@@ -1,5 +1,5 @@
1
1
  module Vcloud
2
2
  module Launcher
3
- VERSION = '0.0.4'
3
+ VERSION = '0.0.5'
4
4
  end
5
5
  end
@@ -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 hardware_config = vm_config[:hardware_config]
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
- @vm_1[:StorageProfile][:name].should == @test_data[:storage_profile]
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
- @vm_1[:StorageProfile][:href].should == @test_data[:vdc_1_sp_href]
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
- @vm_2[:StorageProfile][:name].should == @test_data[:storage_profile]
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
- @vm_2[:StorageProfile][:href].should == @test_data[:vdc_2_sp_href]
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
- @vm_3[:StorageProfile][:name].should == @test_data[:default_storage_profile_name]
50
- @vm_3[:StorageProfile][:href].should == @test_data[:default_storage_profile_href]
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
- 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 == true
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
- @vm_4[:StorageProfile][:name].should == @test_data[:default_storage_profile_name]
61
- @vm_4[:StorageProfile][:href].should == @test_data[:default_storage_profile_href]
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
- @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
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 == true
75
- @fog_interface.delete_vapp(@vapp_id_2).should == true
76
- @fog_interface.delete_vapp(@vapp_id_3).should == true
77
- @fog_interface.delete_vapp(@vapp_id_4).should == true
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 == test_data_1[:vapp_name]
22
- provisioned_vapp[:Children][:Vm].count.should == 1
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 == true
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 == @test_data[:vapp_name]
53
- @vapp[:'ovf:NetworkSection'][:'ovf:Network'].count.should == 2
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 == '8192'
67
- extract_cpu(@vm).should == '4'
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 == 6
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 == true
76
- @vm_metadata[:is_integer].should == -999
77
- @vm_metadata[:is_string].should == 'Hello World'
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 == 3
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 == 2
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 == @test_data[:network1]
96
- primary_nic[:NetworkConnectionIndex].should == @vm[:NetworkConnectionSection][:PrimaryNetworkConnectionIndex]
97
- primary_nic[:IpAddress].should == @test_data[:network1_ip]
98
- primary_nic[:IpAddressAllocationMode].should == 'MANUAL'
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 == @test_data[:network2]
102
- second_nic[:NetworkConnectionIndex].should == '1'
103
- second_nic[:IpAddress].should == @test_data[:network2_ip]
104
- second_nic[:IpAddressAllocationMode].should == 'MANUAL'
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 == @test_data[:vapp_name]
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 == @test_data[:storage_profile]
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 == true
122
+ @fog_interface.delete_vapp(@vapp_id).should eq(true)
123
123
  end
124
124
  end
125
125
 
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,2 @@
1
1
  require 'erb_helper'
2
2
  require 'vcloud/launcher'
3
- require 'support/stub_fog_interface.rb'
@@ -2,47 +2,75 @@ require 'spec_helper'
2
2
 
3
3
  module Vcloud
4
4
  describe Launcher::Launch do
5
- before(:each) do
6
- config_loader = double(:config_loader)
7
- expect(Vcloud::Core::ConfigLoader).to receive(:new).and_return(config_loader)
8
- @successful_app_1 = {
9
- :name => "successful app 1",
10
- :vdc_name => "Test Vdc",
11
- :catalog => "default",
12
- :catalog_item => "ubuntu-precise"
13
- }
14
- @fake_failing_app = {
15
- :name => "fake failing app",
16
- :vdc_name => "wrong vdc",
17
- :catalog => "default",
18
- :catalog_item => "ubuntu-precise"
19
- }
20
- @successful_app_2 = {
21
- :name => "successful app 2",
22
- :vdc_name => "Test Vdc",
23
- :catalog => "default",
24
- :catalog_item => "ubuntu-precise"
25
- }
26
- expect(config_loader).to receive(:load_config).
27
- and_return({:vapps => [@successful_app_1, @fake_failing_app, @successful_app_2]})
28
- end
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
- it "should stop on failure by default" do
31
- expect(Vcloud::Launcher::VappOrchestrator).to receive(:provision).with(@successful_app_1).and_return(double(:vapp, :power_on => true))
32
- expect(Vcloud::Launcher::VappOrchestrator).to receive(:provision).with(@fake_failing_app).and_raise(RuntimeError.new('failed to find vdc'))
33
- expect(Vcloud::Launcher::VappOrchestrator).not_to receive(:provision).with(@successful_app_2)
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
- it "should continue on error if cli option continue-on-error is set" do
40
- expect(Vcloud::Launcher::VappOrchestrator).to receive(:provision).with(@successful_app_1).and_return(double(:vapp, :power_on => true))
41
- expect(Vcloud::Launcher::VappOrchestrator).to receive(:provision).with(@fake_failing_app).and_raise(RuntimeError.new('failed to find vdc'))
42
- expect(Vcloud::Launcher::VappOrchestrator).to receive(:provision).with(@successful_app_2).and_return(double(:vapp, :power_on => true))
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::Launcher.logger.should_receive(:info).with('Found existing vApp test-vapp-1 in vDC \'test-vdc-1\'. Skipping.')
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
@@ -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.12'
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
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-01 00:00:00.000000000 Z
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.12
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.12
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: -3318848198983750692
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
@@ -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