fog-vsphere 1.11.3 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/CONTRIBUTORS.md +1 -0
- data/lib/fog/vsphere/compute.rb +3 -0
- data/lib/fog/vsphere/models/compute/server.rb +6 -2
- data/lib/fog/vsphere/models/compute/ticket.rb +17 -0
- data/lib/fog/vsphere/models/compute/tickets.rb +25 -0
- data/lib/fog/vsphere/requests/compute/vm_acquire_ticket.rb +34 -0
- data/lib/fog/vsphere/version.rb +1 -1
- data/tests/models/compute/server_tests.rb +3 -0
- data/tests/models/compute/ticket_tests.rb +14 -0
- data/tests/models/compute/tickets_tests.rb +10 -0
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6948368d6c3ede9335c8c621c43c5c72a54f8747
|
4
|
+
data.tar.gz: e5eb87794542a2b897959da77baedea015f77d97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7b9b802dbbf729f610364aa5a08fe9ad2bce3f1653ff6832db9ed752c362028342fad45571ffa13ca69f3c357ad727ad415a94c6699797021696e2d33b55f2a
|
7
|
+
data.tar.gz: d1e3c7165715a76e4b08d3ba9af8e16895c426396bef500986d02be02bb7cae94e6a41c9daf3d4feee2f3362a04471f7a1e53b52eea2e74b1d8a3dd8ec037bac
|
data/CHANGELOG.md
CHANGED
data/CONTRIBUTORS.md
CHANGED
@@ -75,6 +75,7 @@
|
|
75
75
|
* karmab <karimboumedhel@gmail.com>
|
76
76
|
* karimb <karimboumedhel@gmail.com>
|
77
77
|
* milo_cheung <milo.cheung@appcara.com>
|
78
|
+
* scottd018 <scottd018@users.noreply.github.com>
|
78
79
|
* slivik <jakub.sliva@gmail.com>
|
79
80
|
* theOpenBit <theopenbit@users.noreply.github.com>
|
80
81
|
* tipt0e <topo-2@charter.net>
|
data/lib/fog/vsphere/compute.rb
CHANGED
@@ -49,6 +49,8 @@ module Fog
|
|
49
49
|
collection :rules
|
50
50
|
model :host
|
51
51
|
collection :hosts
|
52
|
+
model :ticket
|
53
|
+
collection :tickets
|
52
54
|
|
53
55
|
request_path 'fog/vsphere/requests/compute'
|
54
56
|
request :current_time
|
@@ -123,6 +125,7 @@ module Fog
|
|
123
125
|
request :modify_vm_controller
|
124
126
|
request :vm_revert_snapshot
|
125
127
|
request :vm_remove_snapshot
|
128
|
+
request :vm_acquire_ticket
|
126
129
|
|
127
130
|
module Shared
|
128
131
|
attr_reader :vsphere_is_vcenter
|
@@ -97,13 +97,13 @@ module Fog
|
|
97
97
|
|
98
98
|
def start(options = {})
|
99
99
|
requires :instance_uuid
|
100
|
-
service.vm_power_on('instance_uuid' => instance_uuid)
|
100
|
+
service.vm_power_on('instance_uuid' => instance_uuid) unless ready?
|
101
101
|
end
|
102
102
|
|
103
103
|
def stop(options = {})
|
104
104
|
options = { :force => !tools_installed? || !tools_running? }.merge(options)
|
105
105
|
requires :instance_uuid
|
106
|
-
service.vm_power_off('instance_uuid' => instance_uuid, 'force' => options[:force])
|
106
|
+
service.vm_power_off('instance_uuid' => instance_uuid, 'force' => options[:force]) unless power_state == 'poweredOff'
|
107
107
|
end
|
108
108
|
|
109
109
|
def suspend(options = {})
|
@@ -324,6 +324,10 @@ module Fog
|
|
324
324
|
(path.split('/').reject {|e| e.empty?} - ["Datacenters", datacenter, "vm"]).join("/")
|
325
325
|
end
|
326
326
|
|
327
|
+
def acquire_ticket(type = nil)
|
328
|
+
service.tickets(:server => self).create
|
329
|
+
end
|
330
|
+
|
327
331
|
private
|
328
332
|
|
329
333
|
def defaults
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'fog/compute/models/server'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class Vsphere
|
6
|
+
class Ticket < Fog::Model
|
7
|
+
|
8
|
+
attribute :server_id
|
9
|
+
|
10
|
+
attribute :ticket
|
11
|
+
attribute :host
|
12
|
+
attribute :port
|
13
|
+
attribute :ssl_thumbprint
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Vsphere
|
4
|
+
class Tickets < Fog::Collection
|
5
|
+
autoload :Ticket, File.expand_path('../ticket', __FILE__)
|
6
|
+
|
7
|
+
model Fog::Compute::Vsphere::Ticket
|
8
|
+
|
9
|
+
attr_accessor :server
|
10
|
+
|
11
|
+
def create(opts = {})
|
12
|
+
requires :server
|
13
|
+
raise 'server must be a Fog::Compute::Vsphere::Server' unless server.is_a?(Fog::Compute::Vsphere::Server)
|
14
|
+
new(
|
15
|
+
service.vm_acquire_ticket(
|
16
|
+
opts.merge(
|
17
|
+
'instance_uuid' => server.instance_uuid
|
18
|
+
)
|
19
|
+
)
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Vsphere
|
4
|
+
class Real
|
5
|
+
def vm_acquire_ticket(options = {})
|
6
|
+
raise ArgumentError, "instance_uuid is a required parameter" unless options.key?('instance_uuid')
|
7
|
+
ticket_type = options['ticket_type'] || 'webmks'
|
8
|
+
|
9
|
+
vm_mob_ref = get_vm_ref(options['instance_uuid'])
|
10
|
+
|
11
|
+
ticket = vm_mob_ref.AcquireTicket(:ticketType => ticket_type)
|
12
|
+
{
|
13
|
+
'ticket' => ticket.ticket,
|
14
|
+
'host' => ticket.host,
|
15
|
+
'port' => ticket.port,
|
16
|
+
'ssl_thumbprint' => ticket.sslThumbprint
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class Mock
|
22
|
+
def vm_acquire_ticket(options = {})
|
23
|
+
raise ArgumentError, "instance_uuid is a required parameter" unless options.key?('instance_uuid')
|
24
|
+
{
|
25
|
+
'ticket' => 'fdsfdsf',
|
26
|
+
'host' => 'esxi.example.com',
|
27
|
+
'port' => 443,
|
28
|
+
'ssl_thumbprint' => '1C:63:E1:BD:56:03:EB:44:85:12:12:FC:DA:40:11:65:0E:30:A1:B8'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/fog/vsphere/version.rb
CHANGED
@@ -36,6 +36,9 @@ Shindo.tests('Fog::Compute[:vsphere] | server model', ['vsphere']) do
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
39
|
+
test('tickets') do
|
40
|
+
test('acquire ticket successfully') { server.acquire_ticket.kind_of? Fog::Compute::Vsphere::Ticket }
|
41
|
+
end
|
39
42
|
end
|
40
43
|
tests('have attributes') do
|
41
44
|
model_attribute_hash = server.attributes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Shindo.tests('Fog::Compute[:vsphere] | hosts collection', ['vsphere']) do
|
2
|
+
|
3
|
+
servers = Fog::Compute[:vsphere].servers
|
4
|
+
server = servers.last
|
5
|
+
ticket = server.acquire_ticket
|
6
|
+
|
7
|
+
tests('A ticket') do
|
8
|
+
test('should have a ticket') { not ticket.ticket.empty? }
|
9
|
+
test('should have a host') { not ticket.host.empty? }
|
10
|
+
test('should have a port') { ticket.port.kind_of? Fixnum }
|
11
|
+
test('should have a ssl ssl_thumbprint') { not ticket.ssl_thumbprint.empty? }
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Shindo.tests('Fog::Compute[:vsphere] | hosts collection', ['vsphere']) do
|
2
|
+
|
3
|
+
service = Fog::Compute[:vsphere]
|
4
|
+
server = service.servers.last
|
5
|
+
|
6
|
+
tests('The tickets collection') do
|
7
|
+
test('should create a ticket for a server') { service.tickets(:server => server).create.kind_of? Fog::Compute::Vsphere::Ticket }
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-vsphere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- J.R. Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-core
|
@@ -182,6 +182,8 @@ files:
|
|
182
182
|
- lib/fog/vsphere/models/compute/storage_pods.rb
|
183
183
|
- lib/fog/vsphere/models/compute/template.rb
|
184
184
|
- lib/fog/vsphere/models/compute/templates.rb
|
185
|
+
- lib/fog/vsphere/models/compute/ticket.rb
|
186
|
+
- lib/fog/vsphere/models/compute/tickets.rb
|
185
187
|
- lib/fog/vsphere/models/compute/volume.rb
|
186
188
|
- lib/fog/vsphere/models/compute/volumes.rb
|
187
189
|
- lib/fog/vsphere/requests/compute/cloudinit_to_customspec.rb
|
@@ -238,6 +240,7 @@ files:
|
|
238
240
|
- lib/fog/vsphere/requests/compute/revert_to_snapshot.rb
|
239
241
|
- lib/fog/vsphere/requests/compute/set_vm_customvalue.rb
|
240
242
|
- lib/fog/vsphere/requests/compute/upload_iso.rb
|
243
|
+
- lib/fog/vsphere/requests/compute/vm_acquire_ticket.rb
|
241
244
|
- lib/fog/vsphere/requests/compute/vm_clone.rb
|
242
245
|
- lib/fog/vsphere/requests/compute/vm_config_vnc.rb
|
243
246
|
- lib/fog/vsphere/requests/compute/vm_destroy.rb
|
@@ -268,6 +271,8 @@ files:
|
|
268
271
|
- tests/models/compute/server_tests.rb
|
269
272
|
- tests/models/compute/server_unit_tests.rb
|
270
273
|
- tests/models/compute/servers_tests.rb
|
274
|
+
- tests/models/compute/ticket_tests.rb
|
275
|
+
- tests/models/compute/tickets_tests.rb
|
271
276
|
- tests/requests/compute/current_time_tests.rb
|
272
277
|
- tests/requests/compute/folder_destroy_tests.rb
|
273
278
|
- tests/requests/compute/get_network_tests.rb
|
@@ -316,7 +321,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
316
321
|
version: '0'
|
317
322
|
requirements: []
|
318
323
|
rubyforge_project:
|
319
|
-
rubygems_version: 2.6.
|
324
|
+
rubygems_version: 2.6.11
|
320
325
|
signing_key:
|
321
326
|
specification_version: 4
|
322
327
|
summary: Module for the 'fog' gem to support VMware vSphere.
|
@@ -332,6 +337,8 @@ test_files:
|
|
332
337
|
- tests/models/compute/server_tests.rb
|
333
338
|
- tests/models/compute/server_unit_tests.rb
|
334
339
|
- tests/models/compute/servers_tests.rb
|
340
|
+
- tests/models/compute/ticket_tests.rb
|
341
|
+
- tests/models/compute/tickets_tests.rb
|
335
342
|
- tests/requests/compute/current_time_tests.rb
|
336
343
|
- tests/requests/compute/folder_destroy_tests.rb
|
337
344
|
- tests/requests/compute/get_network_tests.rb
|