vagrant-vsphere 0.19.0 → 0.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.bumpversion.cfg +1 -1
- data/.rubocop.yml +13 -0
- data/.rubocop_todo.yml +37 -0
- data/CHANGELOG.md +189 -0
- data/DEVELOPMENT.md +67 -0
- data/Gemfile +2 -3
- data/README.md +86 -175
- data/Rakefile +4 -1
- data/lib/vSphere/action.rb +22 -28
- data/lib/vSphere/action/clone.rb +46 -46
- data/lib/vSphere/action/close_vsphere.rb +8 -10
- data/lib/vSphere/action/connect_vsphere.rb +6 -6
- data/lib/vSphere/action/destroy.rb +6 -6
- data/lib/vSphere/action/get_ssh_info.rb +4 -5
- data/lib/vSphere/action/get_state.rb +3 -5
- data/lib/vSphere/action/is_created.rb +2 -2
- data/lib/vSphere/action/is_running.rb +2 -2
- data/lib/vSphere/action/message_already_created.rb +2 -2
- data/lib/vSphere/action/message_not_created.rb +1 -1
- data/lib/vSphere/action/message_not_running.rb +1 -1
- data/lib/vSphere/action/power_off.rb +2 -2
- data/lib/vSphere/action/power_on.rb +4 -4
- data/lib/vSphere/config.rb +2 -2
- data/lib/vSphere/plugin.rb +5 -6
- data/lib/vSphere/provider.rb +1 -1
- data/lib/vSphere/util/machine_helpers.rb +6 -6
- data/lib/vSphere/util/vim_helpers.rb +27 -23
- data/lib/vSphere/util/vm_helpers.rb +1 -2
- data/lib/vSphere/version.rb +1 -1
- data/lib/vagrant-vsphere.rb +1 -1
- data/spec/action_spec.rb +1 -0
- data/spec/clone_spec.rb +40 -42
- data/spec/connect_vsphere_spec.rb +8 -8
- data/spec/get_ssh_info_spec.rb +2 -2
- data/spec/spec_helper.rb +59 -63
- data/vSphere.gemspec +5 -4
- metadata +19 -1
@@ -6,14 +6,14 @@ describe VagrantPlugins::VSphere::Action::ConnectVSphere do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'should connect to vSphere' do
|
9
|
-
expect(VIM).to have_received(:connect).with(
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
16
|
-
|
9
|
+
expect(VIM).to have_received(:connect).with(
|
10
|
+
host: @env[:machine].provider_config.host,
|
11
|
+
user: @env[:machine].provider_config.user,
|
12
|
+
password: @env[:machine].provider_config.password,
|
13
|
+
insecure: @env[:machine].provider_config.insecure,
|
14
|
+
proxyHost: @env[:machine].provider_config.proxy_host,
|
15
|
+
proxyPort: @env[:machine].provider_config.proxy_port
|
16
|
+
)
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'should add the vSphere connection to the environment' do
|
data/spec/get_ssh_info_spec.rb
CHANGED
@@ -8,7 +8,7 @@ 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
|
-
expect(@env.
|
11
|
+
expect(@env.key?(:machine_ssh_info)).to be true
|
12
12
|
expect(@env[:machine_ssh_info]).to be nil
|
13
13
|
end
|
14
14
|
|
@@ -17,7 +17,7 @@ describe VagrantPlugins::VSphere::Action::GetSshInfo do
|
|
17
17
|
|
18
18
|
call
|
19
19
|
|
20
|
-
expect(@env.
|
20
|
+
expect(@env.key?(:machine_ssh_info)).to be true
|
21
21
|
expect(@env[:machine_ssh_info]).to be nil
|
22
22
|
end
|
23
23
|
|
data/spec/spec_helper.rb
CHANGED
@@ -23,7 +23,6 @@ NAME = 'vm'
|
|
23
23
|
IP_ADDRESS = '127.0.0.1'
|
24
24
|
|
25
25
|
RSpec.configure do |config|
|
26
|
-
|
27
26
|
# removes deprecation warnings.
|
28
27
|
# http://stackoverflow.com/questions/20275510/how-to-avoid-deprecation-warning-for-stub-chain-in-rspec-3-0/20296359#20296359
|
29
28
|
config.mock_with :rspec do |c|
|
@@ -36,111 +35,108 @@ RSpec.configure do |config|
|
|
36
35
|
end
|
37
36
|
|
38
37
|
provider_config = double(
|
39
|
-
:
|
40
|
-
:
|
41
|
-
:
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
53
|
-
:
|
54
|
-
:
|
55
|
-
:
|
56
|
-
:
|
57
|
-
:
|
58
|
-
:
|
59
|
-
:
|
38
|
+
host: 'testhost.com',
|
39
|
+
user: 'testuser',
|
40
|
+
password: 'testpassword',
|
41
|
+
data_center_name: nil,
|
42
|
+
compute_resource_name: 'testcomputeresource',
|
43
|
+
resource_pool_name: 'testresourcepool',
|
44
|
+
vm_base_path: nil,
|
45
|
+
template_name: TEMPLATE,
|
46
|
+
name: NAME,
|
47
|
+
insecure: true,
|
48
|
+
validate: [],
|
49
|
+
customization_spec_name: nil,
|
50
|
+
data_store_name: nil,
|
51
|
+
clone_from_vm: nil,
|
52
|
+
linked_clone: nil,
|
53
|
+
proxy_host: nil,
|
54
|
+
proxy_port: nil,
|
55
|
+
vlan: nil,
|
56
|
+
memory_mb: nil,
|
57
|
+
cpu_count: nil,
|
58
|
+
mac: nil)
|
60
59
|
vm_config = double(
|
61
|
-
:
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
:
|
60
|
+
vm: double('config_vm',
|
61
|
+
box: nil,
|
62
|
+
synced_folders: [],
|
63
|
+
provisioners: [],
|
64
|
+
hostname: nil,
|
65
|
+
communicator: nil,
|
66
|
+
networks: [[:private_network, { ip: '0.0.0.0' }]],
|
67
|
+
graceful_halt_timeout: 0.1),
|
68
|
+
validate: []
|
70
69
|
)
|
71
|
-
@app = double 'app', :
|
70
|
+
@app = double 'app', call: true
|
72
71
|
@machine = double 'machine',
|
73
72
|
:provider_config => provider_config,
|
74
73
|
:config => vm_config,
|
75
|
-
:state => double('state', :
|
74
|
+
:state => double('state', id: nil),
|
76
75
|
:communicate => double('communicator', :ready? => true),
|
77
76
|
:ssh_info => {},
|
78
77
|
:data_dir => Pathname.new(''),
|
79
78
|
:id => nil,
|
80
79
|
:id= => nil,
|
81
|
-
:guest => double('guest', :
|
82
|
-
|
80
|
+
:guest => double('guest', capability: nil)
|
83
81
|
|
84
82
|
@env = {
|
85
|
-
|
86
|
-
|
83
|
+
machine: @machine,
|
84
|
+
ui: double('ui', info: nil, output: nil)
|
87
85
|
}
|
88
86
|
|
89
87
|
@vm = double('vm',
|
90
|
-
:
|
91
|
-
:
|
92
|
-
:
|
93
|
-
:
|
94
|
-
:
|
88
|
+
runtime: double('runtime', powerState: nil),
|
89
|
+
guest: double('guest', ipAddress: IP_ADDRESS),
|
90
|
+
Destroy_Task: double('result', wait_for_completion: nil),
|
91
|
+
PowerOffVM_Task: double('result', wait_for_completion: nil),
|
92
|
+
PowerOnVM_Task: double('result', wait_for_completion: nil))
|
95
93
|
|
96
94
|
vm_folder = double('vm_folder')
|
97
95
|
vm_folder.stub(:findByUuid).with(EXISTING_UUID).and_return(@vm)
|
98
96
|
vm_folder.stub(:findByUuid).with(MISSING_UUID).and_return(nil)
|
99
97
|
vm_folder.stub(:findByUuid).with(nil).and_return(nil)
|
100
98
|
|
101
|
-
|
102
99
|
@child_resource_pool = double('testresourcepool')
|
103
|
-
@root_resource_pool = double('pools', :
|
100
|
+
@root_resource_pool = double('pools', find: @child_resource_pool)
|
104
101
|
|
105
102
|
@compute_resource = RbVmomi::VIM::ComputeResource.new(nil, nil)
|
106
103
|
@compute_resource.stub(:resourcePool).and_return(@root_resource_pool)
|
107
104
|
|
108
|
-
@host_folder = double('hostFolder', :
|
105
|
+
@host_folder = double('hostFolder', childEntity: double('childEntity', find: @compute_resource))
|
109
106
|
|
110
107
|
@data_center = double('data_center',
|
111
|
-
:
|
112
|
-
:
|
113
|
-
:
|
114
|
-
:
|
108
|
+
vmFolder: vm_folder,
|
109
|
+
pretty_path: "data_center/#{vm_folder}",
|
110
|
+
find_compute_resource: @compute_resource,
|
111
|
+
hostFolder: @host_folder)
|
115
112
|
|
116
113
|
@device = RbVmomi::VIM::VirtualEthernetCard.new
|
117
114
|
@device.stub(:backing).and_return(RbVmomi::VIM::VirtualEthernetCardNetworkBackingInfo.new)
|
118
115
|
|
119
116
|
@virtual_hardware = double('virtual_hardware',
|
120
|
-
:
|
117
|
+
device: [@device])
|
121
118
|
@template_config = double('template_config',
|
122
|
-
:
|
119
|
+
hardware: @virtual_hardware)
|
123
120
|
|
124
121
|
@template = double('template_vm',
|
125
|
-
:
|
126
|
-
:
|
127
|
-
:
|
128
|
-
|
129
|
-
:
|
122
|
+
parent: @data_center,
|
123
|
+
pretty_path: "#{@data_center.pretty_path}/template_vm",
|
124
|
+
CloneVM_Task: double('result',
|
125
|
+
wait_for_completion: double('new_vm', config: double('config', uuid: NEW_UUID))),
|
126
|
+
config: @template_config)
|
130
127
|
|
131
128
|
@data_center.stub(:find_vm).with(TEMPLATE).and_return(@template)
|
132
129
|
|
133
|
-
service_instance = double 'service_instance', :
|
130
|
+
service_instance = double 'service_instance', find_datacenter: @data_center
|
134
131
|
@ip = double 'ip', :ipAddress= => nil
|
135
|
-
@customization_spec = double 'customization spec', :
|
132
|
+
@customization_spec = double 'customization spec', nicSettingMap: [double('nic setting', adapter: double('adapter', ip: @ip))]
|
136
133
|
@customization_spec.stub(:clone).and_return(@customization_spec)
|
137
|
-
customization_spec_manager = double 'customization spec manager', :
|
138
|
-
service_content = double 'service content', :
|
139
|
-
@vim = double 'vim', :
|
134
|
+
customization_spec_manager = double 'customization spec manager', GetCustomizationSpec: double('spec info', spec: @customization_spec)
|
135
|
+
service_content = double 'service content', customizationSpecManager: customization_spec_manager
|
136
|
+
@vim = double 'vim', serviceInstance: service_instance, close: true, serviceContent: service_content
|
140
137
|
|
141
138
|
VIM.stub(:connect).and_return(@vim)
|
142
139
|
VIM.stub(:VirtualMachineRelocateSpec).and_return({})
|
143
|
-
VIM.stub(:VirtualMachineCloneSpec)
|
144
|
-
|
140
|
+
VIM.stub(:VirtualMachineCloneSpec) { |location, _powerOn, _template| { location: location[:location] } }
|
145
141
|
end
|
146
142
|
end
|
data/vSphere.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
2
2
|
require 'vSphere/version'
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
@@ -21,9 +21,10 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.add_development_dependency 'rspec-core'
|
22
22
|
s.add_development_dependency 'rspec-expectations'
|
23
23
|
s.add_development_dependency 'rspec-mocks'
|
24
|
+
s.add_development_dependency 'rubocop', '~> 0.28'
|
24
25
|
|
25
|
-
s.files = `git ls-files`.split(
|
26
|
-
s.executables = s.files.grep(
|
27
|
-
s.test_files = s.files.grep(
|
26
|
+
s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
27
|
+
s.executables = s.files.grep(/^bin\//) { |f| File.basename(f) }
|
28
|
+
s.test_files = s.files.grep(/^(test|spec|features)\//)
|
28
29
|
s.require_path = 'lib'
|
29
30
|
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.19.
|
4
|
+
version: 0.19.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Grauch
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.28'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ~>
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.28'
|
111
125
|
description: Enables Vagrant to manage machines with VMWare vSphere.
|
112
126
|
email:
|
113
127
|
- andrew.grauch@nsidc.org
|
@@ -117,7 +131,11 @@ extra_rdoc_files: []
|
|
117
131
|
files:
|
118
132
|
- .bumpversion.cfg
|
119
133
|
- .gitignore
|
134
|
+
- .rubocop.yml
|
135
|
+
- .rubocop_todo.yml
|
120
136
|
- .travis.yml
|
137
|
+
- CHANGELOG.md
|
138
|
+
- DEVELOPMENT.md
|
121
139
|
- Gemfile
|
122
140
|
- LICENSE.txt
|
123
141
|
- README.md
|