vagrant-vsphere 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d45a1640a54cc4ac0664e27c68354033c93ffa4
4
- data.tar.gz: 8d9c88fd620a038420beba0d12387206e55ebcda
3
+ metadata.gz: 81543750c5ee31e6115c32b28ff14394da3e380d
4
+ data.tar.gz: 13f541745820d6d9708d4ef35332f9ca71b04acb
5
5
  SHA512:
6
- metadata.gz: 2fb7ae63b09ecef5e1f7997bbe392aa4e43b147fc1164ff2587b225a3ca4ae65acfbdd8d63f69f1c32fefee3fb8e4da876f004156645e9d857870314c5b03bd1
7
- data.tar.gz: c88435f3e28890dbf622cbfef423d3e88bf4d3dcac5c051cd87cd2740bda09c64b7581d25e8f4522f527d0e9c4d9a390760a6b121359f1f21c859550a33cb7b4
6
+ metadata.gz: 78d97ccc5a9844e82cc41dbfc3637490ad0caec3e8fe611ff05284c9727212121dc2ddeb17e5a380a7d4a666c9c0a6332941395201ab2e4609f469f783fc56c7
7
+ data.tar.gz: b52dcfda735e1c49c47e5b7a4bdf9c039fbc33c14f3eea3f206a4f9d061c7b2bff776310602381ca99f3fcf940bb471a6c95738920f5f5088fd9e3cbdb630273
data/README.md CHANGED
@@ -12,9 +12,9 @@ This provider is built on top of the [RbVmomi](https://github.com/vmware/rbvmomi
12
12
  * libxml2, libxml2-dev, libxslt, libxslt-dev
13
13
 
14
14
  ## Current Version
15
- **0.8.0**
15
+ **0.8.4**
16
16
 
17
- vagrant-vsphere (0.8.0) is available from [RubyGems.org](https://rubygems.org/)
17
+ vagrant-vsphere (0.8.4) is available from [RubyGems.org](https://rubygems.org/)
18
18
 
19
19
  ## Installation
20
20
 
@@ -90,7 +90,7 @@ This provider has the following settings, all are required unless noted:
90
90
  * `password` - password for connecting to vSphere
91
91
  * `data_center_name` - _Optional_ datacenter containing the computed resource, the template and where the new VM will be created, if not specified the first datacenter found will be used
92
92
  * `compute_resource_name` - _Required if cloning from template_ the name of the host containing the resource pool for the new VM
93
- * `resource_pool_name` - _Required if cloning from template_ the resource pool for the new VM
93
+ * `resource_pool_name` - the resource pool for the new VM. If not supplied, and cloning from a template, uses the root resource pool
94
94
  * `clone_from_vm` - _Optional_ use a virtual machine instead of a template as the source for the cloning operation
95
95
  * `template_name` - the VM or VM template to clone
96
96
  * `name` - _Optional_ name of the new VM, if missing the name will be auto generated
@@ -161,6 +161,8 @@ This is useful if running Vagrant from multiple directories or if multiple machi
161
161
  * fixes additional no error messages
162
162
  * 0.8.3
163
163
  * Fixed "No error message" on rbvmomi method calls. [#74: mkuzmin:rbvmomi-error-messages](https://github.com/nsidc/vagrant-vsphere/pull/74)
164
+ * 0.8.4
165
+ * Use root resource pool when cloning from template[#63: matt-richardson:support-resource-pools-on-vsphere-standard-edition](https://github.com/nsidc/vagrant-vsphere/pull/63)
164
166
 
165
167
 
166
168
 
@@ -28,9 +28,8 @@ module VagrantPlugins
28
28
  errors << I18n.t('vsphere.config.password') if password.nil?
29
29
  errors << I18n.t('vsphere.config.template') if template_name.nil?
30
30
 
31
- # These are only required if we're cloning from an actual template
31
+ # Only required if we're cloning from an actual template
32
32
  errors << I18n.t('vsphere.config.compute_resource') if compute_resource_name.nil? and not clone_from_vm
33
- errors << I18n.t('vsphere.config.resource_pool') if resource_pool_name.nil? and not clone_from_vm
34
33
 
35
34
  { 'vSphere Provider' => errors }
36
35
  end
@@ -14,7 +14,11 @@ module VagrantPlugins
14
14
 
15
15
  def get_resource_pool(connection, machine)
16
16
  cr = get_datacenter(connection, machine).find_compute_resource(machine.provider_config.compute_resource_name) or fail Errors::VSphereError, :missing_compute_resource
17
- cr.resourcePool.find(machine.provider_config.resource_pool_name) or fail Errors::VSphereError, :missing_resource_pool
17
+ rp = cr.resourcePool
18
+ if !(machine.provider_config.resource_pool_name.nil?)
19
+ rp = cr.resourcePool.find(machine.provider_config.resource_pool_name) or fail Errors::VSphereError, :missing_resource_pool
20
+ end
21
+ rp
18
22
  end
19
23
 
20
24
  def get_customization_spec_info_by_name(connection, machine)
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module VSphere
3
- VERSION = '0.8.3'
3
+ VERSION = '0.8.4'
4
4
  end
5
5
  end
@@ -6,27 +6,37 @@ describe VagrantPlugins::VSphere::Action::Clone do
6
6
  end
7
7
 
8
8
  it 'should create a CloneVM task' do
9
- call
10
- @template.should have_received(:CloneVM_Task).with({
9
+ call
10
+ expect(@template).to have_received(:CloneVM_Task).with({
11
11
  :folder => @data_center,
12
12
  :name => NAME,
13
- :spec => {}
13
+ :spec => {:location => {:pool => @child_resource_pool} }
14
14
  })
15
15
  end
16
16
 
17
17
  it 'should set the machine id to be the new UUID' do
18
18
  call
19
- @machine.should have_received(:id=).with(NEW_UUID)
19
+ expect(@machine).to have_received(:id=).with(NEW_UUID)
20
20
  end
21
21
 
22
22
  it 'should call the next item in the middleware stack' do
23
23
  call
24
- @app.should have_received :call
24
+ expect(@app).to have_received :call
25
25
  end
26
-
26
+
27
27
  it 'should set static IP when given config spec' do
28
28
  @machine.provider_config.stub(:customization_spec_name).and_return('spec')
29
29
  call
30
- @ip.should have_received(:ipAddress=).with('0.0.0.0')
30
+ expect(@ip).to have_received(:ipAddress=).with('0.0.0.0')
31
+ end
32
+
33
+ it 'should use root resource pool when cloning from template and no resource pool specified' do
34
+ @machine.provider_config.stub(:resource_pool_name).and_return(nil)
35
+ call
36
+ expect(@template).to have_received(:CloneVM_Task).with({
37
+ :folder => @data_center,
38
+ :name => NAME,
39
+ :spec => {:location => {:pool => @root_resource_pool } }
40
+ })
31
41
  end
32
- end
42
+ end
@@ -6,7 +6,7 @@ describe VagrantPlugins::VSphere::Action::ConnectVSphere do
6
6
  end
7
7
 
8
8
  it 'should connect to vSphere' do
9
- VIM.should have_received(:connect).with({
9
+ expect(VIM).to have_received(:connect).with({
10
10
  :host => @env[:machine].provider_config.host,
11
11
  :user => @env[:machine].provider_config.user,
12
12
  :password => @env[:machine].provider_config.password,
@@ -17,10 +17,10 @@ describe VagrantPlugins::VSphere::Action::ConnectVSphere do
17
17
  end
18
18
 
19
19
  it 'should add the vSphere connection to the environment' do
20
- @env[:vSphere_connection].should be @vim
20
+ expect(@env[:vSphere_connection]).to be @vim
21
21
  end
22
22
 
23
23
  it 'should call the next item in the middleware stack' do
24
- @app.should have_received :call
24
+ expect(@app).to have_received :call
25
25
  end
26
26
  end
@@ -10,7 +10,7 @@ describe VagrantPlugins::VSphere::Action::Destroy do
10
10
 
11
11
  call
12
12
 
13
- @env[:machine].should have_received(:id=).with(nil)
13
+ expect(@env[:machine]).to have_received(:id=).with(nil)
14
14
  end
15
15
 
16
16
  it 'should not create a Destroy task if VM is not found' do
@@ -18,7 +18,7 @@ describe VagrantPlugins::VSphere::Action::Destroy do
18
18
 
19
19
  call
20
20
 
21
- @vm.should_not have_received :Destroy_Task
21
+ expect(@vm).not_to have_received :Destroy_Task
22
22
  end
23
23
 
24
24
  it 'should create a VM Destroy task if the VM exists' do
@@ -26,6 +26,6 @@ describe VagrantPlugins::VSphere::Action::Destroy do
26
26
 
27
27
  call
28
28
 
29
- @vm.should have_received :Destroy_Task
29
+ expect(@vm).to have_received :Destroy_Task
30
30
  end
31
- end
31
+ end
@@ -8,8 +8,8 @@ describe VagrantPlugins::VSphere::Action::GetSshInfo do
8
8
  it 'should set the ssh info to nil if machine ID is not set' do
9
9
  call
10
10
 
11
- @env.has_key?(:machine_ssh_info).should be true
12
- @env[:machine_ssh_info].should be nil
11
+ expect(@env.has_key?(:machine_ssh_info)).to be true
12
+ expect(@env[:machine_ssh_info]).to be nil
13
13
  end
14
14
 
15
15
  it 'should set the ssh info to nil for a VM that does not exist' do
@@ -17,8 +17,8 @@ describe VagrantPlugins::VSphere::Action::GetSshInfo do
17
17
 
18
18
  call
19
19
 
20
- @env.has_key?(:machine_ssh_info).should be true
21
- @env[:machine_ssh_info].should be nil
20
+ expect(@env.has_key?(:machine_ssh_info)).to be true
21
+ expect(@env[:machine_ssh_info]).to be nil
22
22
  end
23
23
 
24
24
  it 'should set the ssh info host to the IP an existing VM' do
@@ -26,6 +26,6 @@ describe VagrantPlugins::VSphere::Action::GetSshInfo do
26
26
 
27
27
  call
28
28
 
29
- @env[:machine_ssh_info][:host].should be IP_ADDRESS
29
+ expect(@env[:machine_ssh_info][:host]).to be IP_ADDRESS
30
30
  end
31
- end
31
+ end
@@ -8,7 +8,7 @@ describe VagrantPlugins::VSphere::Action::GetState do
8
8
  it 'should set state id to not created if machine ID is not set' do
9
9
  call
10
10
 
11
- @env[:machine_state_id].should be :not_created
11
+ expect(@env[:machine_state_id]).to be :not_created
12
12
  end
13
13
 
14
14
  it 'should set state id to not created if VM is not found' do
@@ -16,7 +16,7 @@ describe VagrantPlugins::VSphere::Action::GetState do
16
16
 
17
17
  call
18
18
 
19
- @env[:machine_state_id].should be :not_created
19
+ expect(@env[:machine_state_id]).to be :not_created
20
20
  end
21
21
 
22
22
  it 'should set state id to running if machine is powered on' do
@@ -25,7 +25,7 @@ describe VagrantPlugins::VSphere::Action::GetState do
25
25
 
26
26
  call
27
27
 
28
- @env[:machine_state_id].should be :running
28
+ expect(@env[:machine_state_id]).to be :running
29
29
  end
30
30
 
31
31
  it 'should set state id to powered off if machine is powered off' do
@@ -34,7 +34,7 @@ describe VagrantPlugins::VSphere::Action::GetState do
34
34
 
35
35
  call
36
36
 
37
- @env[:machine_state_id].should be :poweroff
37
+ expect(@env[:machine_state_id]).to be :poweroff
38
38
  end
39
39
 
40
40
  it 'should set state id to powered off if machine is suspended' do
@@ -43,12 +43,12 @@ describe VagrantPlugins::VSphere::Action::GetState do
43
43
 
44
44
  call
45
45
 
46
- @env[:machine_state_id].should be :poweroff
46
+ expect(@env[:machine_state_id]).to be :poweroff
47
47
  end
48
48
 
49
49
  it 'should call the next item in the middleware stack' do
50
50
  call
51
51
 
52
- @app.should have_received :call
52
+ expect(@app).to have_received :call
53
53
  end
54
54
  end
@@ -11,7 +11,7 @@ describe VagrantPlugins::VSphere::Action::IsCreated do
11
11
 
12
12
  call
13
13
 
14
- @env[:result].should be true
14
+ expect(@env[:result]).to be true
15
15
  end
16
16
 
17
17
  it 'should set result to false if the VM does not exist' do
@@ -19,11 +19,11 @@ describe VagrantPlugins::VSphere::Action::IsCreated do
19
19
 
20
20
  call
21
21
 
22
- @env[:result].should be false
22
+ expect(@env[:result]).to be false
23
23
  end
24
24
 
25
25
  it 'should call the next item in the middleware stack' do
26
26
  call
27
- @app.should have_received :call
27
+ expect(@app).to have_received :call
28
28
  end
29
- end
29
+ end
@@ -22,6 +22,13 @@ NAME = 'vm'
22
22
  IP_ADDRESS = '127.0.0.1'
23
23
 
24
24
  RSpec.configure do |config|
25
+
26
+ # removes deprecation warnings.
27
+ # http://stackoverflow.com/questions/20275510/how-to-avoid-deprecation-warning-for-stub-chain-in-rspec-3-0/20296359#20296359
28
+ config.mock_with :rspec do |c|
29
+ c.syntax = [:should, :expect]
30
+ end
31
+
25
32
  config.before(:each) do
26
33
  def call
27
34
  described_class.new(@app, @env).call(@env)
@@ -74,9 +81,12 @@ RSpec.configure do |config|
74
81
  vm_folder.stub(:findByUuid).with(MISSING_UUID).and_return(nil)
75
82
  vm_folder.stub(:findByUuid).with(nil).and_return(nil)
76
83
 
84
+ @child_resource_pool = double('testresourcepool')
85
+ @root_resource_pool = double('pools', :find => @child_resource_pool)
86
+
77
87
  @data_center = double('data_center',
78
88
  :vmFolder => vm_folder,
79
- :find_compute_resource => double('compute resource', :resourcePool => double('pools', :find => {})))
89
+ :find_compute_resource => double('compute resource', :resourcePool => @root_resource_pool))
80
90
 
81
91
  @template = double('template_vm',
82
92
  :parent => @data_center,
@@ -87,14 +97,15 @@ RSpec.configure do |config|
87
97
 
88
98
  service_instance = double 'service_instance', :find_datacenter => @data_center
89
99
  @ip = double 'ip', :ipAddress= => nil
90
- customization_spec = double 'customization spec', :nicSettingMap => [double('nic setting', :adapter => double('adapter', :ip => @ip))]
91
- customization_spec.stub(:clone).and_return(customization_spec)
92
- customization_spec_manager = double 'customization spec manager', :GetCustomizationSpec => double('spec info', :spec => customization_spec)
100
+ @customization_spec = double 'customization spec', :nicSettingMap => [double('nic setting', :adapter => double('adapter', :ip => @ip))]
101
+ @customization_spec.stub(:clone).and_return(@customization_spec)
102
+ customization_spec_manager = double 'customization spec manager', :GetCustomizationSpec => double('spec info', :spec => @customization_spec)
93
103
  service_content = double 'service content', :customizationSpecManager => customization_spec_manager
94
104
  @vim = double 'vim', :serviceInstance => service_instance, :close => true, :serviceContent => service_content
95
105
 
96
106
  VIM.stub(:connect).and_return(@vim)
97
107
  VIM.stub(:VirtualMachineRelocateSpec).and_return({})
98
- VIM.stub(:VirtualMachineCloneSpec).and_return({})
108
+ VIM.stub(:VirtualMachineCloneSpec) do |location, powerOn, template| { :location => location[:location] } end
109
+
99
110
  end
100
111
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-vsphere
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Grauch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-03 00:00:00.000000000 Z
11
+ date: 2014-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri