fog-vsphere 2.5.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +4 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +9 -0
- data/README.md +7 -1
- data/fog-vsphere.gemspec +2 -1
- data/lib/fog-vsphere.rb +1 -0
- data/lib/fog/bin/vsphere.rb +1 -1
- data/lib/fog/vsphere.rb +2 -4
- data/lib/fog/vsphere/compute.rb +23 -6
- data/lib/fog/vsphere/models/compute/cdrom.rb +2 -2
- data/lib/fog/vsphere/models/compute/cdroms.rb +3 -3
- data/lib/fog/vsphere/models/compute/cluster.rb +2 -2
- data/lib/fog/vsphere/models/compute/clusters.rb +3 -3
- data/lib/fog/vsphere/models/compute/customfield.rb +2 -2
- data/lib/fog/vsphere/models/compute/customfields.rb +3 -3
- data/lib/fog/vsphere/models/compute/customvalue.rb +2 -2
- data/lib/fog/vsphere/models/compute/customvalues.rb +5 -5
- data/lib/fog/vsphere/models/compute/datacenter.rb +2 -2
- data/lib/fog/vsphere/models/compute/datacenters.rb +3 -3
- data/lib/fog/vsphere/models/compute/datastore.rb +2 -2
- data/lib/fog/vsphere/models/compute/datastores.rb +3 -3
- data/lib/fog/vsphere/models/compute/folder.rb +2 -2
- data/lib/fog/vsphere/models/compute/folders.rb +3 -3
- data/lib/fog/vsphere/models/compute/host.rb +2 -2
- data/lib/fog/vsphere/models/compute/hosts.rb +4 -4
- data/lib/fog/vsphere/models/compute/interface.rb +2 -2
- data/lib/fog/vsphere/models/compute/interfaces.rb +8 -8
- data/lib/fog/vsphere/models/compute/interfacetype.rb +2 -2
- data/lib/fog/vsphere/models/compute/interfacetypes.rb +5 -5
- data/lib/fog/vsphere/models/compute/network.rb +2 -2
- data/lib/fog/vsphere/models/compute/networks.rb +3 -3
- data/lib/fog/vsphere/models/compute/process.rb +2 -2
- data/lib/fog/vsphere/models/compute/resource_pool.rb +2 -2
- data/lib/fog/vsphere/models/compute/resource_pools.rb +3 -3
- data/lib/fog/vsphere/models/compute/rule.rb +2 -2
- data/lib/fog/vsphere/models/compute/rules.rb +4 -4
- data/lib/fog/vsphere/models/compute/scsicontroller.rb +2 -2
- data/lib/fog/vsphere/models/compute/server.rb +6 -6
- data/lib/fog/vsphere/models/compute/servers.rb +4 -4
- data/lib/fog/vsphere/models/compute/servertype.rb +2 -2
- data/lib/fog/vsphere/models/compute/servertypes.rb +4 -4
- data/lib/fog/vsphere/models/compute/snapshot.rb +2 -2
- data/lib/fog/vsphere/models/compute/snapshots.rb +3 -3
- data/lib/fog/vsphere/models/compute/storage_pod.rb +2 -2
- data/lib/fog/vsphere/models/compute/storage_pods.rb +3 -3
- data/lib/fog/vsphere/models/compute/template.rb +2 -2
- data/lib/fog/vsphere/models/compute/templates.rb +3 -3
- data/lib/fog/vsphere/models/compute/ticket.rb +2 -2
- data/lib/fog/vsphere/models/compute/tickets.rb +4 -4
- data/lib/fog/vsphere/models/compute/volume.rb +3 -3
- data/lib/fog/vsphere/models/compute/volumes.rb +5 -5
- data/lib/fog/vsphere/requests/compute/cloudinit_to_customspec.rb +2 -2
- data/lib/fog/vsphere/requests/compute/create_folder.rb +2 -2
- data/lib/fog/vsphere/requests/compute/create_group.rb +2 -2
- data/lib/fog/vsphere/requests/compute/create_rule.rb +2 -2
- data/lib/fog/vsphere/requests/compute/create_vm.rb +2 -2
- data/lib/fog/vsphere/requests/compute/current_time.rb +2 -2
- data/lib/fog/vsphere/requests/compute/destroy_group.rb +2 -2
- data/lib/fog/vsphere/requests/compute/destroy_rule.rb +2 -2
- data/lib/fog/vsphere/requests/compute/folder_destroy.rb +2 -2
- data/lib/fog/vsphere/requests/compute/get_cluster.rb +5 -4
- data/lib/fog/vsphere/requests/compute/get_compute_resource.rb +3 -3
- data/lib/fog/vsphere/requests/compute/get_datacenter.rb +4 -4
- data/lib/fog/vsphere/requests/compute/get_datastore.rb +3 -3
- data/lib/fog/vsphere/requests/compute/get_folder.rb +6 -6
- data/lib/fog/vsphere/requests/compute/get_host.rb +3 -3
- data/lib/fog/vsphere/requests/compute/get_interface_type.rb +3 -3
- data/lib/fog/vsphere/requests/compute/get_network.rb +4 -4
- data/lib/fog/vsphere/requests/compute/get_resource_pool.rb +3 -3
- data/lib/fog/vsphere/requests/compute/get_server_type.rb +5 -5
- data/lib/fog/vsphere/requests/compute/get_storage_pod.rb +3 -3
- data/lib/fog/vsphere/requests/compute/get_template.rb +2 -2
- data/lib/fog/vsphere/requests/compute/get_virtual_machine.rb +4 -4
- data/lib/fog/vsphere/requests/compute/get_vm_first_scsi_controller.rb +3 -3
- data/lib/fog/vsphere/requests/compute/host_finish_maintenance.rb +2 -2
- data/lib/fog/vsphere/requests/compute/host_shutdown.rb +2 -2
- data/lib/fog/vsphere/requests/compute/host_start_maintenance.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_child_snapshots.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_clusters.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_compute_resources.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_customfields.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_datacenters.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_datastores.rb +4 -4
- data/lib/fog/vsphere/requests/compute/list_folders.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_groups.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_hosts.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_interface_types.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_networks.rb +4 -4
- data/lib/fog/vsphere/requests/compute/list_processes.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_resource_pools.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_rules.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_server_types.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_storage_pods.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_templates.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_vm_cdroms.rb +3 -3
- data/lib/fog/vsphere/requests/compute/list_vm_customvalues.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_vm_interfaces.rb +3 -3
- data/lib/fog/vsphere/requests/compute/list_vm_scsi_controllers.rb +4 -4
- data/lib/fog/vsphere/requests/compute/list_vm_snapshots.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_vm_volumes.rb +2 -2
- data/lib/fog/vsphere/requests/compute/modify_vm_cdrom.rb +2 -2
- data/lib/fog/vsphere/requests/compute/modify_vm_controller.rb +2 -2
- data/lib/fog/vsphere/requests/compute/modify_vm_interface.rb +4 -4
- data/lib/fog/vsphere/requests/compute/modify_vm_volume.rb +2 -2
- data/lib/fog/vsphere/requests/compute/revert_to_snapshot.rb +2 -2
- data/lib/fog/vsphere/requests/compute/set_vm_customvalue.rb +2 -2
- data/lib/fog/vsphere/requests/compute/update_vm.rb +2 -2
- data/lib/fog/vsphere/requests/compute/upload_iso.rb +4 -4
- data/lib/fog/vsphere/requests/compute/vm_acquire_ticket.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +11 -8
- data/lib/fog/vsphere/requests/compute/vm_config_vnc.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_destroy.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_execute.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_migrate.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_power_off.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_power_on.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_reboot.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_reconfig_cdrom.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_reconfig_cpus.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_reconfig_hardware.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_reconfig_memory.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_relocate.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_remove_snapshot.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_rename.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_revert_snapshot.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_suspend.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_take_snapshot.rb +2 -2
- data/lib/fog/vsphere/version.rb +1 -1
- data/tests/helper.rb +3 -0
- data/tests/models/compute/cluster_tests.rb +3 -3
- data/tests/models/compute/hosts_tests.rb +1 -1
- data/tests/models/compute/rules_tests.rb +1 -1
- data/tests/models/compute/server_tests.rb +4 -4
- data/tests/models/compute/server_unit_tests.rb +1 -1
- data/tests/models/compute/servers_tests.rb +1 -1
- data/tests/models/compute/tickets_tests.rb +1 -1
- data/tests/requests/compute/get_network_tests.rb +23 -15
- data/tests/requests/compute/revert_to_snapshot_tests.rb +1 -1
- data/tests/requests/compute/update_vm_tests.rb +1 -1
- data/tests/requests/compute/vm_clone_tests.rb +10 -5
- metadata +26 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3104c3caaef8f008444f574b175899511cfb25ce937ab983ea7e2ca6c0973b97
|
4
|
+
data.tar.gz: 7272ca524f7453b3984522de5e493c7f394681f9a2a7624f88001085857240a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00a479bae8d9529d030289f650ddb16785ff33742e50f8059897c3189a87b9fdba401dd41b77cf8b533778d2953f665d0c7386e3d6c26b02f1a8c3cf984dfe11
|
7
|
+
data.tar.gz: f1185b6844ae1b427b9f4064f04ce10ab3198bca8b822e3c6bddaaf8cc78494c8ab66acfe73a7bb705e5a92b7bf7f3f8cd9a02d7499ca0628f3cdbd1b4606b69
|
data/.rubocop_todo.yml
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## v3.0.0
|
2
|
+
|
3
|
+
* Change module namespace to Fog::Vsphere::Compute (#192)
|
4
|
+
* Update ruby string method to prevent traceback (#189)
|
5
|
+
* Allow builds with rbvmomi 2.0.0+ (#187)
|
6
|
+
* Raise error in case path and cluster do not exist (#183)
|
7
|
+
* Update vm_clone template to not always be false (#180)
|
8
|
+
* fetch datacenter by vm_mob_ref.path if user does not have permission to access hosts (#176)
|
9
|
+
|
1
10
|
## v2.5.0
|
2
11
|
|
3
12
|
* Expose extraConfig from user_data for vm_clone #172
|
data/README.md
CHANGED
@@ -26,6 +26,12 @@ Or install it yourself as:
|
|
26
26
|
gem install fog-vsphere
|
27
27
|
```
|
28
28
|
|
29
|
+
## Upgrading
|
30
|
+
|
31
|
+
In version 3.0.0 we have changed the namespacing of `Compute` service.
|
32
|
+
`Fog::Compute::Vsphere` became `Fog::Vsphere::Compute` as recommended by fog-core.
|
33
|
+
We hope we are not causing any issues as `Fog::Compute[:vsphere]` is only public API.
|
34
|
+
|
29
35
|
## Usage
|
30
36
|
|
31
37
|
To connect to your vSphere instance with Fog vSphere:
|
@@ -67,7 +73,7 @@ compute.list_virtual_machines
|
|
67
73
|
|
68
74
|
# List a VM's SCSI controllers
|
69
75
|
compute.list_vm_scsi_controllers('ab589f9a-af35-428e-9690-9b96587d86f3')
|
70
|
-
#=> [<Fog::Compute::
|
76
|
+
#=> [<Fog::Vsphere::Compute::SCSIController
|
71
77
|
#=> shared_bus='noSharing',
|
72
78
|
#=> type='VirtualLsiLogicController',
|
73
79
|
#=> unit_number=7,
|
data/fog-vsphere.gemspec
CHANGED
@@ -22,12 +22,13 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.required_ruby_version = '>= 2.0.0'
|
23
23
|
|
24
24
|
spec.add_runtime_dependency 'fog-core'
|
25
|
-
spec.add_runtime_dependency 'rbvmomi', '
|
25
|
+
spec.add_runtime_dependency 'rbvmomi', '>= 1.9', '< 3'
|
26
26
|
|
27
27
|
spec.add_development_dependency 'bundler', '~> 1.10'
|
28
28
|
spec.add_development_dependency 'pry', '~> 0.10'
|
29
29
|
spec.add_development_dependency 'rake', '~> 10.0'
|
30
30
|
spec.add_development_dependency 'minitest', '~> 5.8'
|
31
31
|
spec.add_development_dependency 'rubocop', '~> 0.50.0'
|
32
|
+
spec.add_development_dependency 'mocha', '~> 1.8'
|
32
33
|
spec.add_development_dependency 'shindo', '~> 0.3'
|
33
34
|
end
|
data/lib/fog-vsphere.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'fog/vsphere'
|
data/lib/fog/bin/vsphere.rb
CHANGED
data/lib/fog/vsphere.rb
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
require 'fog/core'
|
2
2
|
|
3
3
|
module Fog
|
4
|
-
module Compute
|
5
|
-
autoload :Vsphere, File.expand_path('../vsphere/compute.rb', __FILE__)
|
6
|
-
end
|
7
|
-
|
8
4
|
module Vsphere
|
9
5
|
extend Fog::Provider
|
10
6
|
|
@@ -14,6 +10,8 @@ module Fog
|
|
14
10
|
class NotFound < ServiceError; end
|
15
11
|
end
|
16
12
|
|
13
|
+
autoload :Compute, File.expand_path('../vsphere/compute', __FILE__)
|
14
|
+
|
17
15
|
service(:compute, 'Compute')
|
18
16
|
|
19
17
|
# This helper was originally added as Fog.class_as_string and moved to core but only used here
|
data/lib/fog/vsphere/compute.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'digest/sha2'
|
2
2
|
# rubocop:disable Lint/RescueWithoutErrorClass
|
3
|
+
# rubocop:disable Metrics/ModuleLength
|
3
4
|
module Fog
|
4
|
-
module
|
5
|
-
class
|
5
|
+
module Vsphere
|
6
|
+
class Compute < Fog::Service
|
6
7
|
requires :vsphere_username, :vsphere_password, :vsphere_server
|
7
8
|
recognizes :vsphere_port, :vsphere_path, :vsphere_ns
|
8
9
|
recognizes :vsphere_rev, :vsphere_ssl, :vsphere_expected_pubkey_hash
|
@@ -199,12 +200,28 @@ module Fog
|
|
199
200
|
# finished cloning.
|
200
201
|
if attrs['hypervisor'].is_a?(RbVmomi::VIM::HostSystem)
|
201
202
|
host = attrs['hypervisor']
|
203
|
+
|
204
|
+
# @note
|
205
|
+
# - User might not have permission to access host
|
206
|
+
# - i.e. host.name might raise NoPermission error
|
207
|
+
has_permission_to_access_host = true
|
208
|
+
begin
|
209
|
+
host.name
|
210
|
+
rescue RbVmomi::Fault => e
|
211
|
+
raise e unless e.message && e.message['NoPermission:']
|
212
|
+
has_permission_to_access_host = false
|
213
|
+
end
|
214
|
+
|
202
215
|
attrs['datacenter'] = proc {
|
203
216
|
begin
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
217
|
+
if has_permission_to_access_host
|
218
|
+
parent_attribute(host.path, :datacenter)[1]
|
219
|
+
else
|
220
|
+
parent_attribute(vm_mob_ref.path, :datacenter)[1]
|
221
|
+
end
|
222
|
+
rescue
|
223
|
+
nil
|
224
|
+
end
|
208
225
|
}
|
209
226
|
attrs['cluster'] = proc {
|
210
227
|
begin
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Vsphere
|
3
|
+
class Compute
|
4
4
|
class Cdroms < Fog::Collection
|
5
5
|
attribute :instance_uuid, alias: :server_id
|
6
|
-
model Fog::Compute::
|
6
|
+
model Fog::Vsphere::Compute::Cdrom
|
7
7
|
|
8
8
|
def all(_filters = {})
|
9
9
|
load service.list_vm_cdroms(instance_uuid)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Vsphere
|
3
|
+
class Compute
|
4
4
|
class Clusters < Fog::Collection
|
5
5
|
autoload :Cluster, File.expand_path('../cluster', __FILE__)
|
6
6
|
|
7
|
-
model Fog::Compute::
|
7
|
+
model Fog::Vsphere::Compute::Cluster
|
8
8
|
attr_accessor :datacenter
|
9
9
|
|
10
10
|
def all(filters = {})
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Vsphere
|
3
|
+
class Compute
|
4
4
|
class Customfields < Fog::Collection
|
5
5
|
autoload :Customfield, File.expand_path('../customfield', __FILE__)
|
6
6
|
|
7
|
-
model Fog::Compute::
|
7
|
+
model Fog::Vsphere::Compute::Customfield
|
8
8
|
|
9
9
|
attr_accessor :vm
|
10
10
|
|
@@ -1,17 +1,17 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Vsphere
|
3
|
+
class Compute
|
4
4
|
class Customvalues < Fog::Collection
|
5
5
|
autoload :Customvalue, File.expand_path('../customvalue', __FILE__)
|
6
6
|
|
7
|
-
model Fog::Compute::
|
7
|
+
model Fog::Vsphere::Compute::Customvalue
|
8
8
|
|
9
9
|
attr_accessor :vm
|
10
10
|
|
11
11
|
def all(_filters = {})
|
12
12
|
requires :vm
|
13
13
|
case vm
|
14
|
-
when Fog::Compute::
|
14
|
+
when Fog::Vsphere::Compute::Server
|
15
15
|
load service.list_vm_customvalues(vm.id)
|
16
16
|
else
|
17
17
|
raise 'customvalues should have vm'
|
@@ -21,7 +21,7 @@ module Fog
|
|
21
21
|
def get(key)
|
22
22
|
requires :vm
|
23
23
|
case vm
|
24
|
-
when Fog::Compute::
|
24
|
+
when Fog::Vsphere::Compute::Server
|
25
25
|
load service.list_vm_customvalues(vm.id)
|
26
26
|
else
|
27
27
|
raise 'customvalues should have vm'
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Vsphere
|
3
|
+
class Compute
|
4
4
|
class Datacenters < Fog::Collection
|
5
5
|
autoload :Datacenter, File.expand_path('../datacenter', __FILE__)
|
6
6
|
|
7
|
-
model Fog::Compute::
|
7
|
+
model Fog::Vsphere::Compute::Datacenter
|
8
8
|
|
9
9
|
def all(filters = {})
|
10
10
|
load service.list_datacenters(filters)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Vsphere
|
3
|
+
class Compute
|
4
4
|
class Datastores < Fog::Collection
|
5
5
|
autoload :Datastore, File.expand_path('../datastore', __FILE__)
|
6
6
|
|
7
|
-
model Fog::Compute::
|
7
|
+
model Fog::Vsphere::Compute::Datastore
|
8
8
|
attr_accessor :datacenter, :cluster
|
9
9
|
|
10
10
|
def all(filters = {})
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Vsphere
|
3
|
+
class Compute
|
4
4
|
class Folders < Fog::Collection
|
5
5
|
autoload :Folder, File.expand_path('../folder', __FILE__)
|
6
6
|
|
7
|
-
model Fog::Compute::
|
7
|
+
model Fog::Vsphere::Compute::Folder
|
8
8
|
attr_accessor :datacenter, :type, :path
|
9
9
|
|
10
10
|
def all(filters = {})
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Vsphere
|
3
|
+
class Compute
|
4
4
|
class Hosts < Fog::Collection
|
5
5
|
attribute :datacenter
|
6
6
|
attribute :cluster
|
7
7
|
|
8
|
-
model Fog::Compute::
|
8
|
+
model Fog::Vsphere::Compute::Host
|
9
9
|
|
10
10
|
def all(_filters = {})
|
11
11
|
requires :datacenter, :cluster
|
@@ -14,7 +14,7 @@ module Fog
|
|
14
14
|
|
15
15
|
def get(name)
|
16
16
|
all.find { |host| host.name == name } ||
|
17
|
-
raise(Fog::Compute::
|
17
|
+
raise(Fog::Vsphere::Compute::NotFound, "no such host #{name}")
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Vsphere
|
3
|
+
class Compute
|
4
4
|
class Interfaces < Fog::Collection
|
5
5
|
autoload :Interface, File.expand_path('../interface', __FILE__)
|
6
6
|
|
7
|
-
model Fog::Compute::
|
7
|
+
model Fog::Vsphere::Compute::Interface
|
8
8
|
|
9
9
|
attribute :server_id
|
10
10
|
|
@@ -12,9 +12,9 @@ module Fog
|
|
12
12
|
requires :server_id
|
13
13
|
|
14
14
|
case server
|
15
|
-
when Fog::Compute::
|
15
|
+
when Fog::Vsphere::Compute::Server
|
16
16
|
load service.list_vm_interfaces(server.id)
|
17
|
-
when Fog::Compute::
|
17
|
+
when Fog::Vsphere::Compute::Template
|
18
18
|
load service.list_template_interfaces(server.id)
|
19
19
|
else
|
20
20
|
raise 'interfaces should have vm or template'
|
@@ -28,9 +28,9 @@ module Fog
|
|
28
28
|
requires :server_id
|
29
29
|
|
30
30
|
case server
|
31
|
-
when Fog::Compute::
|
31
|
+
when Fog::Vsphere::Compute::Server
|
32
32
|
interface = service.get_vm_interface(server.id, key: id, mac: id, name: id, datacenter: server.datacenter)
|
33
|
-
when Fog::Compute::
|
33
|
+
when Fog::Vsphere::Compute::Template
|
34
34
|
interface = service.get_template_interfaces(server.id, key: id, mac: id, name: id)
|
35
35
|
else
|
36
36
|
|
@@ -38,7 +38,7 @@ module Fog
|
|
38
38
|
end
|
39
39
|
|
40
40
|
if interface
|
41
|
-
Fog::Compute::
|
41
|
+
Fog::Vsphere::Compute::Interface.new(interface.merge(server_id: server.id, service: service))
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|