vagrant-vsphere 0.7.0 → 0.7.1

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.
Files changed (40) hide show
  1. data/.gitignore +8 -6
  2. data/Gemfile +10 -10
  3. data/LICENSE.txt +23 -23
  4. data/README.md +180 -175
  5. data/Rakefile +16 -16
  6. data/example_box/metadata.json +2 -2
  7. data/lib/vSphere/action.rb +172 -172
  8. data/lib/vSphere/action/clone.rb +131 -127
  9. data/lib/vSphere/action/close_vsphere.rb +23 -23
  10. data/lib/vSphere/action/connect_vsphere.rb +25 -25
  11. data/lib/vSphere/action/destroy.rb +37 -37
  12. data/lib/vSphere/action/get_ssh_info.rb +37 -37
  13. data/lib/vSphere/action/get_state.rb +45 -45
  14. data/lib/vSphere/action/is_created.rb +15 -15
  15. data/lib/vSphere/action/is_running.rb +20 -20
  16. data/lib/vSphere/action/message_already_created.rb +17 -17
  17. data/lib/vSphere/action/message_not_created.rb +17 -17
  18. data/lib/vSphere/action/message_not_running.rb +18 -18
  19. data/lib/vSphere/action/power_off.rb +27 -27
  20. data/lib/vSphere/action/power_on.rb +31 -31
  21. data/lib/vSphere/action/sync_folders.rb +94 -97
  22. data/lib/vSphere/config.rb +37 -37
  23. data/lib/vSphere/errors.rb +14 -11
  24. data/lib/vSphere/plugin.rb +29 -29
  25. data/lib/vSphere/provider.rb +38 -38
  26. data/lib/vSphere/util/machine_helpers.rb +15 -15
  27. data/lib/vSphere/util/vim_helpers.rb +37 -37
  28. data/lib/vSphere/version.rb +5 -5
  29. data/lib/vagrant-vsphere.rb +17 -17
  30. data/locales/en.yml +66 -65
  31. data/spec/action_spec.rb +116 -116
  32. data/spec/clone_spec.rb +31 -31
  33. data/spec/connect_vsphere_spec.rb +23 -23
  34. data/spec/destroy_spec.rb +30 -30
  35. data/spec/get_ssh_info_spec.rb +30 -30
  36. data/spec/get_state_spec.rb +54 -54
  37. data/spec/is_created_spec.rb +28 -28
  38. data/spec/spec_helper.rb +98 -98
  39. data/vSphere.gemspec +29 -28
  40. metadata +14 -8
@@ -1,54 +1,54 @@
1
- require 'spec_helper'
2
-
3
- describe VagrantPlugins::VSphere::Action::GetState do
4
- before :each do
5
- @env[:vSphere_connection] = @vim
6
- end
7
-
8
- it 'should set state id to not created if machine ID is not set' do
9
- call
10
-
11
- @env[:machine_state_id].should be :not_created
12
- end
13
-
14
- it 'should set state id to not created if VM is not found' do
15
- @env[:machine].stub(:id).and_return(MISSING_UUID)
16
-
17
- call
18
-
19
- @env[:machine_state_id].should be :not_created
20
- end
21
-
22
- it 'should set state id to running if machine is powered on' do
23
- @env[:machine].stub(:id).and_return(EXISTING_UUID)
24
- @vm.runtime.stub(:powerState).and_return(described_class::POWERED_ON)
25
-
26
- call
27
-
28
- @env[:machine_state_id].should be :running
29
- end
30
-
31
- it 'should set state id to powered off if machine is powered off' do
32
- @env[:machine].stub(:id).and_return(EXISTING_UUID)
33
- @vm.runtime.stub(:powerState).and_return(described_class::POWERED_OFF)
34
-
35
- call
36
-
37
- @env[:machine_state_id].should be :poweroff
38
- end
39
-
40
- it 'should set state id to powered off if machine is suspended' do
41
- @env[:machine].stub(:id).and_return(EXISTING_UUID)
42
- @vm.runtime.stub(:powerState).and_return(described_class::SUSPENDED)
43
-
44
- call
45
-
46
- @env[:machine_state_id].should be :poweroff
47
- end
48
-
49
- it 'should call the next item in the middleware stack' do
50
- call
51
-
52
- @app.should have_received :call
53
- end
54
- end
1
+ require 'spec_helper'
2
+
3
+ describe VagrantPlugins::VSphere::Action::GetState do
4
+ before :each do
5
+ @env[:vSphere_connection] = @vim
6
+ end
7
+
8
+ it 'should set state id to not created if machine ID is not set' do
9
+ call
10
+
11
+ @env[:machine_state_id].should be :not_created
12
+ end
13
+
14
+ it 'should set state id to not created if VM is not found' do
15
+ @env[:machine].stub(:id).and_return(MISSING_UUID)
16
+
17
+ call
18
+
19
+ @env[:machine_state_id].should be :not_created
20
+ end
21
+
22
+ it 'should set state id to running if machine is powered on' do
23
+ @env[:machine].stub(:id).and_return(EXISTING_UUID)
24
+ @vm.runtime.stub(:powerState).and_return(described_class::POWERED_ON)
25
+
26
+ call
27
+
28
+ @env[:machine_state_id].should be :running
29
+ end
30
+
31
+ it 'should set state id to powered off if machine is powered off' do
32
+ @env[:machine].stub(:id).and_return(EXISTING_UUID)
33
+ @vm.runtime.stub(:powerState).and_return(described_class::POWERED_OFF)
34
+
35
+ call
36
+
37
+ @env[:machine_state_id].should be :poweroff
38
+ end
39
+
40
+ it 'should set state id to powered off if machine is suspended' do
41
+ @env[:machine].stub(:id).and_return(EXISTING_UUID)
42
+ @vm.runtime.stub(:powerState).and_return(described_class::SUSPENDED)
43
+
44
+ call
45
+
46
+ @env[:machine_state_id].should be :poweroff
47
+ end
48
+
49
+ it 'should call the next item in the middleware stack' do
50
+ call
51
+
52
+ @app.should have_received :call
53
+ end
54
+ end
@@ -1,29 +1,29 @@
1
- require 'spec_helper'
2
- require 'vSphere/action/is_created'
3
-
4
- describe VagrantPlugins::VSphere::Action::IsCreated do
5
- before :each do
6
- @env[:vSphere_connection] = @vim
7
- end
8
-
9
- it 'should set result to false if the VM does not exist' do
10
- @env[:machine].state.stub(:id).and_return(:running)
11
-
12
- call
13
-
14
- @env[:result].should be true
15
- end
16
-
17
- it 'should set result to false if the VM does not exist' do
18
- @env[:machine].state.stub(:id).and_return(:not_created)
19
-
20
- call
21
-
22
- @env[:result].should be false
23
- end
24
-
25
- it 'should call the next item in the middleware stack' do
26
- call
27
- @app.should have_received :call
28
- end
1
+ require 'spec_helper'
2
+ require 'vSphere/action/is_created'
3
+
4
+ describe VagrantPlugins::VSphere::Action::IsCreated do
5
+ before :each do
6
+ @env[:vSphere_connection] = @vim
7
+ end
8
+
9
+ it 'should set result to false if the VM does not exist' do
10
+ @env[:machine].state.stub(:id).and_return(:running)
11
+
12
+ call
13
+
14
+ @env[:result].should be true
15
+ end
16
+
17
+ it 'should set result to false if the VM does not exist' do
18
+ @env[:machine].state.stub(:id).and_return(:not_created)
19
+
20
+ call
21
+
22
+ @env[:result].should be false
23
+ end
24
+
25
+ it 'should call the next item in the middleware stack' do
26
+ call
27
+ @app.should have_received :call
28
+ end
29
29
  end
data/spec/spec_helper.rb CHANGED
@@ -1,98 +1,98 @@
1
- require 'rbvmomi'
2
- require 'vSphere/errors'
3
- require 'vSphere/action'
4
- require 'vSphere/action/connect_vsphere'
5
- require 'vSphere/action/close_vsphere'
6
- require 'vSphere/action/is_created'
7
- require 'vSphere/action/get_state'
8
- require 'vSphere/action/get_ssh_info'
9
- require 'vSphere/action/clone'
10
- require 'vSphere/action/message_already_created'
11
- require 'vSphere/action/message_not_created'
12
- require 'vSphere/action/destroy'
13
- require 'vSphere/action/power_off'
14
-
15
- VIM = RbVmomi::VIM
16
-
17
- EXISTING_UUID = 'existing_uuid'
18
- MISSING_UUID = 'missing_uuid'
19
- NEW_UUID = 'new_uuid'
20
- TEMPLATE = 'template'
21
- NAME = 'vm'
22
- IP_ADDRESS = '127.0.0.1'
23
-
24
- RSpec.configure do |config|
25
- config.before(:each) do
26
- def call
27
- described_class.new(@app, @env).call(@env)
28
- end
29
-
30
- provider_config = double(
31
- :host => 'testhost.com',
32
- :user => 'testuser',
33
- :password => 'testpassword',
34
- :data_center_name => nil,
35
- :compute_resource_name => 'testcomputeresource',
36
- :resource_pool_name => 'testresourcepool',
37
- :template_name => TEMPLATE,
38
- :name => NAME,
39
- :insecure => true,
40
- :validate => [],
41
- :customization_spec_name => nil,
42
- :data_store_name => nil,
43
- :clone_from_vm => nil,
44
- :linked_clone => nil)
45
- vm_config = double(
46
- :vm => double('config_vm', :synced_folders => [], :provisioners => [], :networks => [[:private_network, {:ip => '0.0.0.0'}]]),
47
- :validate => []
48
- )
49
- @app = double 'app', :call => true
50
- @machine = double 'machine',
51
- :provider_config => provider_config,
52
- :config => vm_config,
53
- :state => double('state', :id => nil),
54
- :communicate => double('communicator', :ready? => true),
55
- :ssh_info => {},
56
- :id => nil,
57
- :id= => nil
58
- @env = {
59
- :machine => @machine,
60
- :ui => double('ui', :info => nil)
61
- }
62
-
63
- @vm = double('vm',
64
- :runtime => double('runtime', :powerState => nil),
65
- :guest => double('guest', :ipAddress => IP_ADDRESS),
66
- :Destroy_Task => double('result', :wait_for_completion => nil),
67
- :PowerOffVM_Task => double('result', :wait_for_completion => nil),
68
- :PowerOnVM_Task => double('result', :wait_for_completion => nil))
69
-
70
- vm_folder = double('vm_folder')
71
- vm_folder.stub(:findByUuid).with(EXISTING_UUID).and_return(@vm)
72
- vm_folder.stub(:findByUuid).with(MISSING_UUID).and_return(nil)
73
- vm_folder.stub(:findByUuid).with(nil).and_return(nil)
74
-
75
- @data_center = double('data_center',
76
- :vmFolder => vm_folder,
77
- :find_compute_resource => double('compute resource', :resourcePool => double('pools', :find => {})))
78
-
79
- @template = double('template_vm',
80
- :parent => @data_center,
81
- :CloneVM_Task => double('result',
82
- :wait_for_completion => double('new_vm', :config => double('config', :uuid => NEW_UUID))))
83
-
84
- @data_center.stub(:find_vm).with(TEMPLATE).and_return(@template)
85
-
86
- service_instance = double 'service_instance', :find_datacenter => @data_center
87
- @ip = double 'ip', :ipAddress= => nil
88
- customization_spec = double 'customization spec', :nicSettingMap => [double('nic setting', :adapter => double('adapter', :ip => @ip))]
89
- customization_spec.stub(:clone).and_return(customization_spec)
90
- customization_spec_manager = double 'customization spec manager', :GetCustomizationSpec => double('spec info', :spec => customization_spec)
91
- service_content = double 'service content', :customizationSpecManager => customization_spec_manager
92
- @vim = double 'vim', :serviceInstance => service_instance, :close => true, :serviceContent => service_content
93
-
94
- VIM.stub(:connect).and_return(@vim)
95
- VIM.stub(:VirtualMachineRelocateSpec).and_return({})
96
- VIM.stub(:VirtualMachineCloneSpec).and_return({})
97
- end
98
- end
1
+ require 'rbvmomi'
2
+ require 'vSphere/errors'
3
+ require 'vSphere/action'
4
+ require 'vSphere/action/connect_vsphere'
5
+ require 'vSphere/action/close_vsphere'
6
+ require 'vSphere/action/is_created'
7
+ require 'vSphere/action/get_state'
8
+ require 'vSphere/action/get_ssh_info'
9
+ require 'vSphere/action/clone'
10
+ require 'vSphere/action/message_already_created'
11
+ require 'vSphere/action/message_not_created'
12
+ require 'vSphere/action/destroy'
13
+ require 'vSphere/action/power_off'
14
+
15
+ VIM = RbVmomi::VIM
16
+
17
+ EXISTING_UUID = 'existing_uuid'
18
+ MISSING_UUID = 'missing_uuid'
19
+ NEW_UUID = 'new_uuid'
20
+ TEMPLATE = 'template'
21
+ NAME = 'vm'
22
+ IP_ADDRESS = '127.0.0.1'
23
+
24
+ RSpec.configure do |config|
25
+ config.before(:each) do
26
+ def call
27
+ described_class.new(@app, @env).call(@env)
28
+ end
29
+
30
+ provider_config = double(
31
+ :host => 'testhost.com',
32
+ :user => 'testuser',
33
+ :password => 'testpassword',
34
+ :data_center_name => nil,
35
+ :compute_resource_name => 'testcomputeresource',
36
+ :resource_pool_name => 'testresourcepool',
37
+ :template_name => TEMPLATE,
38
+ :name => NAME,
39
+ :insecure => true,
40
+ :validate => [],
41
+ :customization_spec_name => nil,
42
+ :data_store_name => nil,
43
+ :clone_from_vm => nil,
44
+ :linked_clone => nil)
45
+ vm_config = double(
46
+ :vm => double('config_vm', :synced_folders => [], :provisioners => [], :networks => [[:private_network, {:ip => '0.0.0.0'}]]),
47
+ :validate => []
48
+ )
49
+ @app = double 'app', :call => true
50
+ @machine = double 'machine',
51
+ :provider_config => provider_config,
52
+ :config => vm_config,
53
+ :state => double('state', :id => nil),
54
+ :communicate => double('communicator', :ready? => true),
55
+ :ssh_info => {},
56
+ :id => nil,
57
+ :id= => nil
58
+ @env = {
59
+ :machine => @machine,
60
+ :ui => double('ui', :info => nil)
61
+ }
62
+
63
+ @vm = double('vm',
64
+ :runtime => double('runtime', :powerState => nil),
65
+ :guest => double('guest', :ipAddress => IP_ADDRESS),
66
+ :Destroy_Task => double('result', :wait_for_completion => nil),
67
+ :PowerOffVM_Task => double('result', :wait_for_completion => nil),
68
+ :PowerOnVM_Task => double('result', :wait_for_completion => nil))
69
+
70
+ vm_folder = double('vm_folder')
71
+ vm_folder.stub(:findByUuid).with(EXISTING_UUID).and_return(@vm)
72
+ vm_folder.stub(:findByUuid).with(MISSING_UUID).and_return(nil)
73
+ vm_folder.stub(:findByUuid).with(nil).and_return(nil)
74
+
75
+ @data_center = double('data_center',
76
+ :vmFolder => vm_folder,
77
+ :find_compute_resource => double('compute resource', :resourcePool => double('pools', :find => {})))
78
+
79
+ @template = double('template_vm',
80
+ :parent => @data_center,
81
+ :CloneVM_Task => double('result',
82
+ :wait_for_completion => double('new_vm', :config => double('config', :uuid => NEW_UUID))))
83
+
84
+ @data_center.stub(:find_vm).with(TEMPLATE).and_return(@template)
85
+
86
+ service_instance = double 'service_instance', :find_datacenter => @data_center
87
+ @ip = double 'ip', :ipAddress= => nil
88
+ customization_spec = double 'customization spec', :nicSettingMap => [double('nic setting', :adapter => double('adapter', :ip => @ip))]
89
+ customization_spec.stub(:clone).and_return(customization_spec)
90
+ customization_spec_manager = double 'customization spec manager', :GetCustomizationSpec => double('spec info', :spec => customization_spec)
91
+ service_content = double 'service content', :customizationSpecManager => customization_spec_manager
92
+ @vim = double 'vim', :serviceInstance => service_instance, :close => true, :serviceContent => service_content
93
+
94
+ VIM.stub(:connect).and_return(@vim)
95
+ VIM.stub(:VirtualMachineRelocateSpec).and_return({})
96
+ VIM.stub(:VirtualMachineCloneSpec).and_return({})
97
+ end
98
+ end
data/vSphere.gemspec CHANGED
@@ -1,28 +1,29 @@
1
- $:.unshift File.expand_path('../lib', __FILE__)
2
- require 'vSphere/version'
3
-
4
- Gem::Specification.new do |s|
5
- s.name = 'vagrant-vsphere'
6
- s.version = VagrantPlugins::VSphere::VERSION
7
- s.authors = ['Andrew Grauch']
8
- s.email = ['andrew.grauch@nsidc.org']
9
- s.homepage = ''
10
- s.license = 'MIT'
11
- s.summary = 'VMWare vSphere provider'
12
- s.description = 'Enables Vagrant to manage machines with VMWare vSphere.'
13
-
14
- # force the use of Nokogiri 1.5.10 to prevent conflicts with older versions of zlib
15
- s.add_dependency 'nokogiri', '1.5.10'
16
- s.add_dependency 'rbvmomi'
17
- s.add_dependency 'i18n', '~> 0.6.4'
18
-
19
- s.add_development_dependency 'rake'
20
- s.add_development_dependency 'rspec-core'
21
- s.add_development_dependency 'rspec-expectations'
22
- s.add_development_dependency 'rspec-mocks'
23
-
24
- s.files = `git ls-files`.split($/)
25
- s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
26
- s.test_files = s.files.grep(%r{^(test|spec|features)/})
27
- s.require_path = 'lib'
28
- end
1
+ $:.unshift File.expand_path('../lib', __FILE__)
2
+ require 'vSphere/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'vagrant-vsphere'
6
+ s.version = VagrantPlugins::VSphere::VERSION
7
+ s.authors = ['Andrew Grauch']
8
+ s.email = ['andrew.grauch@nsidc.org']
9
+ s.homepage = ''
10
+ s.license = 'MIT'
11
+ s.summary = 'VMWare vSphere provider'
12
+ s.description = 'Enables Vagrant to manage machines with VMWare vSphere.'
13
+
14
+ # force the use of Nokogiri 1.5.10 to prevent conflicts with older versions of zlib
15
+ s.add_dependency 'nokogiri', '~>1.5.10'
16
+ # force the use of rbvmomi 1.6.x to get around this issue: https://github.com/vmware/rbvmomi/pull/32
17
+ s.add_dependency 'rbvmomi', '~> 1.6.0'
18
+ s.add_dependency 'i18n', '~> 0.6.4'
19
+
20
+ s.add_development_dependency 'rake'
21
+ s.add_development_dependency 'rspec-core'
22
+ s.add_development_dependency 'rspec-expectations'
23
+ s.add_development_dependency 'rspec-mocks'
24
+
25
+ s.files = `git ls-files`.split($/)
26
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
27
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
28
+ s.require_path = 'lib'
29
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-vsphere
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,14 +9,14 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-31 00:00:00.000000000 Z
12
+ date: 2014-03-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - '='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
21
  version: 1.5.10
22
22
  type: :runtime
@@ -24,7 +24,7 @@ dependencies:
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - '='
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: 1.5.10
30
30
  - !ruby/object:Gem::Dependency
@@ -32,17 +32,17 @@ dependencies:
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
- - - ! '>='
35
+ - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: '0'
37
+ version: 1.6.0
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ! '>='
43
+ - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: '0'
45
+ version: 1.6.0
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: i18n
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -182,12 +182,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
182
182
  - - ! '>='
183
183
  - !ruby/object:Gem::Version
184
184
  version: '0'
185
+ segments:
186
+ - 0
187
+ hash: -20572808865558022
185
188
  required_rubygems_version: !ruby/object:Gem::Requirement
186
189
  none: false
187
190
  requirements:
188
191
  - - ! '>='
189
192
  - !ruby/object:Gem::Version
190
193
  version: '0'
194
+ segments:
195
+ - 0
196
+ hash: -20572808865558022
191
197
  requirements: []
192
198
  rubyforge_project:
193
199
  rubygems_version: 1.8.23