vsimple 0.1.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.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/README.md +66 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/vsimple.rb +33 -0
- data/lib/vsimple/config.rb +13 -0
- data/lib/vsimple/error.rb +11 -0
- data/lib/vsimple/version.rb +3 -0
- data/lib/vsimple/vm.rb +375 -0
- data/vsimple.gemspec +27 -0
- metadata +126 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bb6e9a72ac2427c4a20d503989bd1aeb0eedf6c9
|
4
|
+
data.tar.gz: 754cf76fbfa08a93b7985d7d49019a97ccf4ba75
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4f84bee0f2e0dcaac067efd5ed13a7e76250365eefa9a40bc8d2e7a30c6b7a071946a6ebfc5d9d4278d64e66c470fe8dcaeaeea67dd6dbb3dc218205cd79e8e7
|
7
|
+
data.tar.gz: e0c5392bf93754501447615f8ada3fc94f66631553f2c04d9956842d0c3a9cd227071b449b81feb5d7a76b383a8587af12fc9b461d3f57dfc6af2d052e3a8fb3
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# Vsimple
|
2
|
+
|
3
|
+
Simple version of rbvmomi easy to use vpshere.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'vsimple'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install vsimple
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```
|
24
|
+
require "vsimple"
|
25
|
+
|
26
|
+
config = {
|
27
|
+
:host => "172.16.1.1",
|
28
|
+
:user => "USER",
|
29
|
+
:pass => "PASS"
|
30
|
+
}
|
31
|
+
|
32
|
+
Vsimple.connect(config)
|
33
|
+
|
34
|
+
Vsimple.set_dc("DATACENTER")
|
35
|
+
Vsimple.set_cluster("cluster")
|
36
|
+
|
37
|
+
vm = Vsimple::VM.new("template/debian-7.3-amd64")
|
38
|
+
begin
|
39
|
+
vm.clone("vms/new_vm.vsimple.fr", {
|
40
|
+
:powerOn => true,
|
41
|
+
:network => {
|
42
|
+
"Network adapter 1" => {
|
43
|
+
:port_group => "ext",
|
44
|
+
:ip => "192.168.42.42/24",
|
45
|
+
:gw => "192.168.42.254",
|
46
|
+
}
|
47
|
+
}
|
48
|
+
})
|
49
|
+
rescue Vsimple::Error => e
|
50
|
+
puts e.msg
|
51
|
+
end
|
52
|
+
```
|
53
|
+
|
54
|
+
## Development
|
55
|
+
|
56
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
57
|
+
|
58
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
59
|
+
|
60
|
+
## Contributing
|
61
|
+
|
62
|
+
1. Fork it ( https://github.com/etna-alternance/vsimple )
|
63
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
64
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
65
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
66
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "vsimple"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/vsimple.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require "rbvmomi"
|
2
|
+
require "vsimple/version"
|
3
|
+
require "vsimple/error"
|
4
|
+
require "vsimple/config"
|
5
|
+
|
6
|
+
require "vsimple/vm"
|
7
|
+
|
8
|
+
class Vsimple
|
9
|
+
|
10
|
+
def self.connect(opts)
|
11
|
+
Vsimple::Config[:auth] = {
|
12
|
+
:path => "/sdk",
|
13
|
+
:port => 443,
|
14
|
+
:use_ssl => true,
|
15
|
+
:insecure => "USE_INSECURE_SSL"
|
16
|
+
}
|
17
|
+
Vsimple::Config[:auth].merge! opts
|
18
|
+
Vsimple::Config[:vim] = RbVmomi::VIM.connect Vsimple::Config[:auth]
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.set_dc(dcname)
|
22
|
+
Vsimple::Config[:dc_name] = dcname
|
23
|
+
Vsimple::Config[:dc] = Vsimple::Config[:vim].serviceInstance.find_datacenter(Vsimple::Config[:dc_name])
|
24
|
+
raise Vsimple::Error.new "Datacenter #{dcname} not found" unless Vsimple::Config[:dc]
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.set_cluster(c_name)
|
28
|
+
Vsimple::Config[:cluster_name] = c_name
|
29
|
+
Vsimple::Config[:cluster] = Vsimple::Config[:dc].hostFolder.childEntity.grep(RbVmomi::VIM::ClusterComputeResource).find { |x| x.name == Vsimple::Config[:cluster_name] }
|
30
|
+
raise Vsimple::Error.new "Cluster #{Config[:c_name]} not found" unless Vsimple::Config[:cluster]
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
data/lib/vsimple/vm.rb
ADDED
@@ -0,0 +1,375 @@
|
|
1
|
+
require 'netaddr'
|
2
|
+
|
3
|
+
class Vsimple
|
4
|
+
class VM
|
5
|
+
|
6
|
+
def initialize(path)
|
7
|
+
@vm = Vsimple::Config[:dc].vmFolder.traverse(path, RbVmomi::VIM::VirtualMachine)
|
8
|
+
raise Vsimple::Error.new "VM #{path} not found" unless @vm
|
9
|
+
end
|
10
|
+
|
11
|
+
def name
|
12
|
+
@vm.name
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.exist?(path)
|
16
|
+
if Vsimple::Config[:dc].vmFolder.traverse(path, RbVmomi::VIM::VirtualMachine)
|
17
|
+
true
|
18
|
+
else
|
19
|
+
false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def powerOn
|
24
|
+
begin
|
25
|
+
@vm.PowerOnVM_Task.wait_for_completion
|
26
|
+
rescue => e
|
27
|
+
raise Vsimple::Error.new "Power on vm #{@vm.name}: #{e.message}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def poweredOff
|
32
|
+
begin
|
33
|
+
@vm.PowerOffVM_Task.wait_for_completion
|
34
|
+
rescue => e
|
35
|
+
raise Vsimple::Error.new "Power off vm #{@vm.name}: #{e.message}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def shutdownGuest
|
40
|
+
begin
|
41
|
+
@vm.ShutdownGuest
|
42
|
+
rescue => e
|
43
|
+
raise Vsimple::Error.new "Shutdown vm #{@vm.name}: #{e.message}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def powerState
|
48
|
+
@vm.summary.runtime.powerState
|
49
|
+
end
|
50
|
+
|
51
|
+
def rebootGuest
|
52
|
+
begin
|
53
|
+
@vm.RebootGuest
|
54
|
+
rescue => e
|
55
|
+
raise Vsimple::Error.new "RebootGuest vm #{@vm.name}: #{e.message}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def guestToolsReady?
|
60
|
+
@vm.guest.toolsRunningStatus == "guestToolsRunning"
|
61
|
+
end
|
62
|
+
|
63
|
+
# Clone the VirtualMachine.
|
64
|
+
#
|
65
|
+
# == Parameters:
|
66
|
+
# name::
|
67
|
+
# Name of the machine. Can be the FQDN.
|
68
|
+
#
|
69
|
+
# vm_config::
|
70
|
+
# machine_options:
|
71
|
+
# * :path => Path of the VM
|
72
|
+
# * :hostname => Hostname of the VM
|
73
|
+
# * :domain => Domain name of the VM
|
74
|
+
# * :powerOn => Flags to start the VM after the clone (true or false)
|
75
|
+
# * :ip_dns => IP separed by commate of the DNS server
|
76
|
+
# * :network => Network configuration. exemple:
|
77
|
+
# vm_config[:network] = {
|
78
|
+
# "Network adapter 1" => {
|
79
|
+
# :port_group => "port_group_name",
|
80
|
+
# :ip => "172.16.1.1/24",
|
81
|
+
# :gw => "172.16.1.254"
|
82
|
+
# }
|
83
|
+
# }
|
84
|
+
# Windows only:
|
85
|
+
# * :commandList
|
86
|
+
# * :password
|
87
|
+
# * :timeZone
|
88
|
+
# * :identification_domainAdmin
|
89
|
+
# * :identification_domainAdminPassword
|
90
|
+
# * :identification_joinDomain
|
91
|
+
# * :identification_joinWorkgroup
|
92
|
+
# * :userData_orgName
|
93
|
+
# * :userData_productId
|
94
|
+
#
|
95
|
+
def clone(name, vm_config={})
|
96
|
+
unless vm_config[:path]
|
97
|
+
if name.include?('/')
|
98
|
+
vm_config[:path] = File.dirname(name)
|
99
|
+
else
|
100
|
+
vm_config[:path] = ""
|
101
|
+
end
|
102
|
+
end
|
103
|
+
name = File.basename(name)
|
104
|
+
|
105
|
+
vm_config[:hostname] ||= name[/^([^.]*)/, 1]
|
106
|
+
vm_config[:domain] ||= name[/^[^.]*.(.*)$/, 1]
|
107
|
+
|
108
|
+
clone_spec = generate_clone_spec(vm_config)
|
109
|
+
dest_folder = Vsimple::Config[:dc].vmFolder.traverse!(vm_config[:path], RbVmomi::VIM::Folder)
|
110
|
+
|
111
|
+
begin
|
112
|
+
@vm.CloneVM_Task(
|
113
|
+
:folder => dest_folder,
|
114
|
+
:name => name,
|
115
|
+
:spec => clone_spec
|
116
|
+
).wait_for_completion
|
117
|
+
rescue => e
|
118
|
+
raise Vsimple::Error.new "Clone vm #{@vm.name}: #{e.message}"
|
119
|
+
end
|
120
|
+
|
121
|
+
Vsimple::VM.new("#{vm_config[:path]}/#{name}")
|
122
|
+
end
|
123
|
+
|
124
|
+
# Check if the machine is a windows
|
125
|
+
#
|
126
|
+
# == Parameters:
|
127
|
+
# vm::
|
128
|
+
# VM instance given by rbvmomi
|
129
|
+
def is_windows?
|
130
|
+
@vm.summary.config.guestFullName =~ /^Microsoft Windows/
|
131
|
+
end
|
132
|
+
|
133
|
+
# Wait until the guest tools of the machine is start or until timeout if given.
|
134
|
+
#
|
135
|
+
# == Parameters:
|
136
|
+
# server::
|
137
|
+
# VM instance given by rbvmomi
|
138
|
+
#
|
139
|
+
# timeout::
|
140
|
+
# Timeout
|
141
|
+
def wait_guest_tools_ready(timeout=nil)
|
142
|
+
wait = 1
|
143
|
+
while @vm.guest.toolsRunningStatus != "guestToolsRunning" && (!timeout || wait < timeout)
|
144
|
+
sleep 1
|
145
|
+
wait += 1
|
146
|
+
end
|
147
|
+
@vm.guest.toolsRunningStatus == "guestToolsRunning"
|
148
|
+
end
|
149
|
+
|
150
|
+
# Wait until the machine stop or until timeout if given
|
151
|
+
#
|
152
|
+
# == Parameters:
|
153
|
+
# server::
|
154
|
+
# VM instance given by rbvmomi
|
155
|
+
#
|
156
|
+
# timeout::
|
157
|
+
# Timeout
|
158
|
+
def wait_to_stop(timeout=nil)
|
159
|
+
wait = 1
|
160
|
+
while @vm.summary.runtime.powerState != "poweredOff" && (!timeout || wait < timeout)
|
161
|
+
sleep 1
|
162
|
+
wait += 1
|
163
|
+
end
|
164
|
+
@vm.summary.runtime.powerState == "poweredOff"
|
165
|
+
end
|
166
|
+
|
167
|
+
|
168
|
+
protected
|
169
|
+
|
170
|
+
|
171
|
+
# Generate the adaptater mapping for a network card
|
172
|
+
#
|
173
|
+
# == Parameters:
|
174
|
+
# ip::
|
175
|
+
# The ip. If not given, use the dhcp configuration
|
176
|
+
# gw::
|
177
|
+
# The gateway.
|
178
|
+
def generate_adapter_map(ip=nil, gw=nil)
|
179
|
+
settings = RbVmomi::VIM.CustomizationIPSettings
|
180
|
+
|
181
|
+
if ip.nil?
|
182
|
+
settings.ip = RbVmomi::VIM::CustomizationDhcpIpGenerator
|
183
|
+
else
|
184
|
+
cidr_ip = NetAddr::CIDR.create(ip)
|
185
|
+
settings.ip = RbVmomi::VIM::CustomizationFixedIp(:ipAddress => cidr_ip.ip)
|
186
|
+
settings.subnetMask = cidr_ip.netmask_ext
|
187
|
+
unless gw.nil?
|
188
|
+
gw_cidr = NetAddr::CIDR.create(gw)
|
189
|
+
settings.gateway = [gw_cidr.ip]
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
adapter_map = RbVmomi::VIM.CustomizationAdapterMapping
|
194
|
+
adapter_map.adapter = settings
|
195
|
+
adapter_map
|
196
|
+
end
|
197
|
+
|
198
|
+
# Find a network with a name.
|
199
|
+
#
|
200
|
+
# == Parameters:
|
201
|
+
# networkName::
|
202
|
+
# The network name.
|
203
|
+
#
|
204
|
+
# == Return Value:
|
205
|
+
# Network instance given by rbvmomi. If the network doesn't exists, an exception will rise.
|
206
|
+
#
|
207
|
+
def find_network(networkName)
|
208
|
+
baseEntity = Vsimple::Config[:dc].network
|
209
|
+
baseEntity.find { |f| f.name == networkName } or raise Vsimple::Error.new "no such network #{networkName}"
|
210
|
+
end
|
211
|
+
|
212
|
+
# Generate the clone specification.
|
213
|
+
#
|
214
|
+
# == Parameters:
|
215
|
+
# vm_config::
|
216
|
+
# The vm configuration for the new VM.
|
217
|
+
def generate_clone_spec(vm_config)
|
218
|
+
rp = Vsimple::Config[:cluster].resourcePool
|
219
|
+
rspec = RbVmomi::VIM.VirtualMachineRelocateSpec(:pool => rp)
|
220
|
+
vm_config[:powerOn] ||= false
|
221
|
+
clone_spec = RbVmomi::VIM.VirtualMachineCloneSpec({
|
222
|
+
:location => rspec,
|
223
|
+
:powerOn => vm_config[:powerOn],
|
224
|
+
:template => false
|
225
|
+
})
|
226
|
+
|
227
|
+
clone_spec.config = RbVmomi::VIM.VirtualMachineConfigSpec(:deviceChange => Array.new)
|
228
|
+
clone_spec.customization = generate_custom_spec(clone_spec, vm_config)
|
229
|
+
|
230
|
+
clone_spec
|
231
|
+
end
|
232
|
+
|
233
|
+
# Generate the Customization Specification.
|
234
|
+
#
|
235
|
+
# == Parameters:
|
236
|
+
# clone_spec::
|
237
|
+
# the clone specification passed by #generate_clone_spec.
|
238
|
+
#
|
239
|
+
# vm_config::
|
240
|
+
# The vm configuration for the new VM.
|
241
|
+
#
|
242
|
+
def generate_custom_spec(clone_spec, vm_config)
|
243
|
+
src_config = @vm.config
|
244
|
+
|
245
|
+
global_ipset = RbVmomi::VIM.CustomizationGlobalIPSettings
|
246
|
+
cust_spec = RbVmomi::VIM.CustomizationSpec(:globalIPSettings => global_ipset)
|
247
|
+
|
248
|
+
cust_spec.globalIPSettings.dnsServerList = vm_config[:ip_dns].split(',') if vm_config[:ip_dns]
|
249
|
+
cust_spec.globalIPSettings.dnsSuffixList = vm_config[:domain].split(',')
|
250
|
+
|
251
|
+
nicSettingMap = []
|
252
|
+
src_cards = []
|
253
|
+
src_config.hardware.device.each do |dev|
|
254
|
+
if dev.deviceInfo.label =~ /^Network adapter/
|
255
|
+
src_cards << dev.deviceInfo.label
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
src_cards.each do |name|
|
260
|
+
if vm_config[:network]
|
261
|
+
config = vm_config[:network][name]
|
262
|
+
else
|
263
|
+
config = nil
|
264
|
+
end
|
265
|
+
|
266
|
+
card = src_config.hardware.device.find { |d| d.deviceInfo.label == name }
|
267
|
+
unless card
|
268
|
+
raise Vsimple::Error.new "Can't find source network card #{name} to customize"
|
269
|
+
end
|
270
|
+
|
271
|
+
if config && config[:port_group]
|
272
|
+
network = find_network(config[:port_group])
|
273
|
+
begin
|
274
|
+
switch_port = RbVmomi::VIM.DistributedVirtualSwitchPortConnection(
|
275
|
+
:switchUuid => network.config.distributedVirtualSwitch.uuid,
|
276
|
+
:portgroupKey => network.key
|
277
|
+
)
|
278
|
+
card.backing.port = switch_port
|
279
|
+
rescue
|
280
|
+
card.backing.deviceName = network.name
|
281
|
+
end
|
282
|
+
else
|
283
|
+
switch_port = RbVmomi::VIM.DistributedVirtualSwitchPortConnection(
|
284
|
+
:switchUuid => card.backing.port.switchUuid,
|
285
|
+
:portgroupKey => card.backing.port.portgroupKey
|
286
|
+
)
|
287
|
+
card.backing.port = switch_port
|
288
|
+
end
|
289
|
+
|
290
|
+
clone_spec.config.deviceChange.push RbVmomi::VIM.VirtualDeviceConfigSpec(
|
291
|
+
:device => card,
|
292
|
+
:operation => "edit"
|
293
|
+
)
|
294
|
+
|
295
|
+
if config && config[:ip]
|
296
|
+
nicSettingMap << generate_adapter_map(config[:ip], config[:gw])
|
297
|
+
else
|
298
|
+
cam = RbVmomi::VIM.CustomizationAdapterMapping
|
299
|
+
cam.adapter = RbVmomi::VIM.CustomizationIPSettings
|
300
|
+
cam.adapter.ip = RbVmomi::VIM.CustomizationDhcpIpGenerator
|
301
|
+
nicSettingMap << cam
|
302
|
+
end
|
303
|
+
|
304
|
+
end
|
305
|
+
|
306
|
+
cust_spec.nicSettingMap = nicSettingMap
|
307
|
+
if is_windows?
|
308
|
+
cust_spec.identity = generate_win_ident(vm_config)
|
309
|
+
cust_spec.options = generate_win_opts
|
310
|
+
else
|
311
|
+
cust_spec.identity = generate_linux_ident(vm_config)
|
312
|
+
end
|
313
|
+
|
314
|
+
cust_spec
|
315
|
+
end
|
316
|
+
|
317
|
+
def generate_win_ident(vm_config)
|
318
|
+
ident = RbVmomi::VIM.CustomizationSysprep
|
319
|
+
|
320
|
+
if vm_config[:commandList]
|
321
|
+
guiRunOnce = RbVmomi::VIM.CustomizationGuiRunOnce
|
322
|
+
guiRunOnce.commandList = vm_config[:commandList]
|
323
|
+
ident.guiRunOnce = guiRunOnce
|
324
|
+
else
|
325
|
+
ident.guiRunOnce = nil
|
326
|
+
end
|
327
|
+
|
328
|
+
guiUnattended = RbVmomi::VIM.CustomizationGuiUnattended
|
329
|
+
guiUnattended.autoLogon = false
|
330
|
+
guiUnattended.autoLogonCount = 1
|
331
|
+
password = RbVmomi::VIM.CustomizationPassword
|
332
|
+
password.plainText = true
|
333
|
+
password.value = vm_config[:password]
|
334
|
+
guiUnattended.password = password
|
335
|
+
guiUnattended.timeZone = "#{vm_config[:timeZone]}"
|
336
|
+
ident.guiUnattended = guiUnattended
|
337
|
+
|
338
|
+
identification = RbVmomi::VIM.CustomizationIdentification
|
339
|
+
identification.domainAdmin = vm_config[:identification_domainAdmin]
|
340
|
+
identification.domainAdminPassword = vm_config[:identification_domainAdminPassword]
|
341
|
+
identification.joinDomain = vm_config[:identification_joinDomain]
|
342
|
+
identification.joinWorkgroup = vm_config[:identification_joinWorkgroup]
|
343
|
+
ident.identification = identification
|
344
|
+
|
345
|
+
userData = RbVmomi::VIM.CustomizationUserData
|
346
|
+
|
347
|
+
computerName = RbVmomi::VIM.CustomizationFixedName
|
348
|
+
computerName.name = vm_config[:hostname].upcase
|
349
|
+
|
350
|
+
userData.computerName = computerName
|
351
|
+
userData.fullName = "#{vm_config[:hostname]}.#{vm_config[:domain]}"
|
352
|
+
userData.orgName = vm_config[:userData_orgName]
|
353
|
+
userData.productId = vm_config[:userData_productId]
|
354
|
+
ident.userData = userData
|
355
|
+
ident
|
356
|
+
end
|
357
|
+
|
358
|
+
def generate_win_opts()
|
359
|
+
new_windowsOptions = RbVmomi::VIM.CustomizationWinOptions
|
360
|
+
new_windowsOptions.changeSID = true
|
361
|
+
new_windowsOptions.deleteAccounts = false
|
362
|
+
new_windowsOptions
|
363
|
+
end
|
364
|
+
|
365
|
+
def generate_linux_ident(vm_config)
|
366
|
+
ident = RbVmomi::VIM.CustomizationLinuxPrep
|
367
|
+
|
368
|
+
ident.hostName = RbVmomi::VIM.CustomizationFixedName
|
369
|
+
ident.hostName.name = vm_config[:hostname]
|
370
|
+
ident.domain = vm_config[:domain]
|
371
|
+
ident
|
372
|
+
end
|
373
|
+
|
374
|
+
end
|
375
|
+
end
|
data/vsimple.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vsimple/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vsimple"
|
8
|
+
spec.version = Vsimple::VERSION
|
9
|
+
spec.authors = ["Steven Pojer"]
|
10
|
+
spec.email = ["steven.pojer@etna-alternance.net"]
|
11
|
+
|
12
|
+
spec.summary = "Simple version of rbvmomi easy to use vpshere."
|
13
|
+
spec.description = spec.summary
|
14
|
+
spec.homepage = "https://github.com/etna-alternance/vsimple"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "rbvmomi", "~> 1.6"
|
22
|
+
spec.add_runtime_dependency "netaddr", "~> 1.5"
|
23
|
+
spec.add_runtime_dependency "mixlib-config", "~> 2.0"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vsimple
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Steven Pojer
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rbvmomi
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: netaddr
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.5'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mixlib-config
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.9'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.9'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
description: Simple version of rbvmomi easy to use vpshere.
|
84
|
+
email:
|
85
|
+
- steven.pojer@etna-alternance.net
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .gitignore
|
91
|
+
- .travis.yml
|
92
|
+
- Gemfile
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- bin/console
|
96
|
+
- bin/setup
|
97
|
+
- lib/vsimple.rb
|
98
|
+
- lib/vsimple/config.rb
|
99
|
+
- lib/vsimple/error.rb
|
100
|
+
- lib/vsimple/version.rb
|
101
|
+
- lib/vsimple/vm.rb
|
102
|
+
- vsimple.gemspec
|
103
|
+
homepage: https://github.com/etna-alternance/vsimple
|
104
|
+
licenses: []
|
105
|
+
metadata: {}
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
requirements: []
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 2.4.6
|
123
|
+
signing_key:
|
124
|
+
specification_version: 4
|
125
|
+
summary: Simple version of rbvmomi easy to use vpshere.
|
126
|
+
test_files: []
|