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.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +4 -0
  3. data/.travis.yml +1 -1
  4. data/CHANGELOG.md +9 -0
  5. data/README.md +7 -1
  6. data/fog-vsphere.gemspec +2 -1
  7. data/lib/fog-vsphere.rb +1 -0
  8. data/lib/fog/bin/vsphere.rb +1 -1
  9. data/lib/fog/vsphere.rb +2 -4
  10. data/lib/fog/vsphere/compute.rb +23 -6
  11. data/lib/fog/vsphere/models/compute/cdrom.rb +2 -2
  12. data/lib/fog/vsphere/models/compute/cdroms.rb +3 -3
  13. data/lib/fog/vsphere/models/compute/cluster.rb +2 -2
  14. data/lib/fog/vsphere/models/compute/clusters.rb +3 -3
  15. data/lib/fog/vsphere/models/compute/customfield.rb +2 -2
  16. data/lib/fog/vsphere/models/compute/customfields.rb +3 -3
  17. data/lib/fog/vsphere/models/compute/customvalue.rb +2 -2
  18. data/lib/fog/vsphere/models/compute/customvalues.rb +5 -5
  19. data/lib/fog/vsphere/models/compute/datacenter.rb +2 -2
  20. data/lib/fog/vsphere/models/compute/datacenters.rb +3 -3
  21. data/lib/fog/vsphere/models/compute/datastore.rb +2 -2
  22. data/lib/fog/vsphere/models/compute/datastores.rb +3 -3
  23. data/lib/fog/vsphere/models/compute/folder.rb +2 -2
  24. data/lib/fog/vsphere/models/compute/folders.rb +3 -3
  25. data/lib/fog/vsphere/models/compute/host.rb +2 -2
  26. data/lib/fog/vsphere/models/compute/hosts.rb +4 -4
  27. data/lib/fog/vsphere/models/compute/interface.rb +2 -2
  28. data/lib/fog/vsphere/models/compute/interfaces.rb +8 -8
  29. data/lib/fog/vsphere/models/compute/interfacetype.rb +2 -2
  30. data/lib/fog/vsphere/models/compute/interfacetypes.rb +5 -5
  31. data/lib/fog/vsphere/models/compute/network.rb +2 -2
  32. data/lib/fog/vsphere/models/compute/networks.rb +3 -3
  33. data/lib/fog/vsphere/models/compute/process.rb +2 -2
  34. data/lib/fog/vsphere/models/compute/resource_pool.rb +2 -2
  35. data/lib/fog/vsphere/models/compute/resource_pools.rb +3 -3
  36. data/lib/fog/vsphere/models/compute/rule.rb +2 -2
  37. data/lib/fog/vsphere/models/compute/rules.rb +4 -4
  38. data/lib/fog/vsphere/models/compute/scsicontroller.rb +2 -2
  39. data/lib/fog/vsphere/models/compute/server.rb +6 -6
  40. data/lib/fog/vsphere/models/compute/servers.rb +4 -4
  41. data/lib/fog/vsphere/models/compute/servertype.rb +2 -2
  42. data/lib/fog/vsphere/models/compute/servertypes.rb +4 -4
  43. data/lib/fog/vsphere/models/compute/snapshot.rb +2 -2
  44. data/lib/fog/vsphere/models/compute/snapshots.rb +3 -3
  45. data/lib/fog/vsphere/models/compute/storage_pod.rb +2 -2
  46. data/lib/fog/vsphere/models/compute/storage_pods.rb +3 -3
  47. data/lib/fog/vsphere/models/compute/template.rb +2 -2
  48. data/lib/fog/vsphere/models/compute/templates.rb +3 -3
  49. data/lib/fog/vsphere/models/compute/ticket.rb +2 -2
  50. data/lib/fog/vsphere/models/compute/tickets.rb +4 -4
  51. data/lib/fog/vsphere/models/compute/volume.rb +3 -3
  52. data/lib/fog/vsphere/models/compute/volumes.rb +5 -5
  53. data/lib/fog/vsphere/requests/compute/cloudinit_to_customspec.rb +2 -2
  54. data/lib/fog/vsphere/requests/compute/create_folder.rb +2 -2
  55. data/lib/fog/vsphere/requests/compute/create_group.rb +2 -2
  56. data/lib/fog/vsphere/requests/compute/create_rule.rb +2 -2
  57. data/lib/fog/vsphere/requests/compute/create_vm.rb +2 -2
  58. data/lib/fog/vsphere/requests/compute/current_time.rb +2 -2
  59. data/lib/fog/vsphere/requests/compute/destroy_group.rb +2 -2
  60. data/lib/fog/vsphere/requests/compute/destroy_rule.rb +2 -2
  61. data/lib/fog/vsphere/requests/compute/folder_destroy.rb +2 -2
  62. data/lib/fog/vsphere/requests/compute/get_cluster.rb +5 -4
  63. data/lib/fog/vsphere/requests/compute/get_compute_resource.rb +3 -3
  64. data/lib/fog/vsphere/requests/compute/get_datacenter.rb +4 -4
  65. data/lib/fog/vsphere/requests/compute/get_datastore.rb +3 -3
  66. data/lib/fog/vsphere/requests/compute/get_folder.rb +6 -6
  67. data/lib/fog/vsphere/requests/compute/get_host.rb +3 -3
  68. data/lib/fog/vsphere/requests/compute/get_interface_type.rb +3 -3
  69. data/lib/fog/vsphere/requests/compute/get_network.rb +4 -4
  70. data/lib/fog/vsphere/requests/compute/get_resource_pool.rb +3 -3
  71. data/lib/fog/vsphere/requests/compute/get_server_type.rb +5 -5
  72. data/lib/fog/vsphere/requests/compute/get_storage_pod.rb +3 -3
  73. data/lib/fog/vsphere/requests/compute/get_template.rb +2 -2
  74. data/lib/fog/vsphere/requests/compute/get_virtual_machine.rb +4 -4
  75. data/lib/fog/vsphere/requests/compute/get_vm_first_scsi_controller.rb +3 -3
  76. data/lib/fog/vsphere/requests/compute/host_finish_maintenance.rb +2 -2
  77. data/lib/fog/vsphere/requests/compute/host_shutdown.rb +2 -2
  78. data/lib/fog/vsphere/requests/compute/host_start_maintenance.rb +2 -2
  79. data/lib/fog/vsphere/requests/compute/list_child_snapshots.rb +2 -2
  80. data/lib/fog/vsphere/requests/compute/list_clusters.rb +2 -2
  81. data/lib/fog/vsphere/requests/compute/list_compute_resources.rb +2 -2
  82. data/lib/fog/vsphere/requests/compute/list_customfields.rb +2 -2
  83. data/lib/fog/vsphere/requests/compute/list_datacenters.rb +2 -2
  84. data/lib/fog/vsphere/requests/compute/list_datastores.rb +4 -4
  85. data/lib/fog/vsphere/requests/compute/list_folders.rb +2 -2
  86. data/lib/fog/vsphere/requests/compute/list_groups.rb +2 -2
  87. data/lib/fog/vsphere/requests/compute/list_hosts.rb +2 -2
  88. data/lib/fog/vsphere/requests/compute/list_interface_types.rb +2 -2
  89. data/lib/fog/vsphere/requests/compute/list_networks.rb +4 -4
  90. data/lib/fog/vsphere/requests/compute/list_processes.rb +2 -2
  91. data/lib/fog/vsphere/requests/compute/list_resource_pools.rb +2 -2
  92. data/lib/fog/vsphere/requests/compute/list_rules.rb +2 -2
  93. data/lib/fog/vsphere/requests/compute/list_server_types.rb +2 -2
  94. data/lib/fog/vsphere/requests/compute/list_storage_pods.rb +2 -2
  95. data/lib/fog/vsphere/requests/compute/list_templates.rb +2 -2
  96. data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +2 -2
  97. data/lib/fog/vsphere/requests/compute/list_vm_cdroms.rb +3 -3
  98. data/lib/fog/vsphere/requests/compute/list_vm_customvalues.rb +2 -2
  99. data/lib/fog/vsphere/requests/compute/list_vm_interfaces.rb +3 -3
  100. data/lib/fog/vsphere/requests/compute/list_vm_scsi_controllers.rb +4 -4
  101. data/lib/fog/vsphere/requests/compute/list_vm_snapshots.rb +2 -2
  102. data/lib/fog/vsphere/requests/compute/list_vm_volumes.rb +2 -2
  103. data/lib/fog/vsphere/requests/compute/modify_vm_cdrom.rb +2 -2
  104. data/lib/fog/vsphere/requests/compute/modify_vm_controller.rb +2 -2
  105. data/lib/fog/vsphere/requests/compute/modify_vm_interface.rb +4 -4
  106. data/lib/fog/vsphere/requests/compute/modify_vm_volume.rb +2 -2
  107. data/lib/fog/vsphere/requests/compute/revert_to_snapshot.rb +2 -2
  108. data/lib/fog/vsphere/requests/compute/set_vm_customvalue.rb +2 -2
  109. data/lib/fog/vsphere/requests/compute/update_vm.rb +2 -2
  110. data/lib/fog/vsphere/requests/compute/upload_iso.rb +4 -4
  111. data/lib/fog/vsphere/requests/compute/vm_acquire_ticket.rb +2 -2
  112. data/lib/fog/vsphere/requests/compute/vm_clone.rb +11 -8
  113. data/lib/fog/vsphere/requests/compute/vm_config_vnc.rb +2 -2
  114. data/lib/fog/vsphere/requests/compute/vm_destroy.rb +2 -2
  115. data/lib/fog/vsphere/requests/compute/vm_execute.rb +2 -2
  116. data/lib/fog/vsphere/requests/compute/vm_migrate.rb +2 -2
  117. data/lib/fog/vsphere/requests/compute/vm_power_off.rb +2 -2
  118. data/lib/fog/vsphere/requests/compute/vm_power_on.rb +2 -2
  119. data/lib/fog/vsphere/requests/compute/vm_reboot.rb +2 -2
  120. data/lib/fog/vsphere/requests/compute/vm_reconfig_cdrom.rb +2 -2
  121. data/lib/fog/vsphere/requests/compute/vm_reconfig_cpus.rb +2 -2
  122. data/lib/fog/vsphere/requests/compute/vm_reconfig_hardware.rb +2 -2
  123. data/lib/fog/vsphere/requests/compute/vm_reconfig_memory.rb +2 -2
  124. data/lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb +2 -2
  125. data/lib/fog/vsphere/requests/compute/vm_relocate.rb +2 -2
  126. data/lib/fog/vsphere/requests/compute/vm_remove_snapshot.rb +2 -2
  127. data/lib/fog/vsphere/requests/compute/vm_rename.rb +2 -2
  128. data/lib/fog/vsphere/requests/compute/vm_revert_snapshot.rb +2 -2
  129. data/lib/fog/vsphere/requests/compute/vm_suspend.rb +2 -2
  130. data/lib/fog/vsphere/requests/compute/vm_take_snapshot.rb +2 -2
  131. data/lib/fog/vsphere/version.rb +1 -1
  132. data/tests/helper.rb +3 -0
  133. data/tests/models/compute/cluster_tests.rb +3 -3
  134. data/tests/models/compute/hosts_tests.rb +1 -1
  135. data/tests/models/compute/rules_tests.rb +1 -1
  136. data/tests/models/compute/server_tests.rb +4 -4
  137. data/tests/models/compute/server_unit_tests.rb +1 -1
  138. data/tests/models/compute/servers_tests.rb +1 -1
  139. data/tests/models/compute/tickets_tests.rb +1 -1
  140. data/tests/requests/compute/get_network_tests.rb +23 -15
  141. data/tests/requests/compute/revert_to_snapshot_tests.rb +1 -1
  142. data/tests/requests/compute/update_vm_tests.rb +1 -1
  143. data/tests/requests/compute/vm_clone_tests.rb +10 -5
  144. metadata +26 -5
@@ -1,6 +1,6 @@
1
1
  module Fog
2
- module Compute
3
- class Vsphere
2
+ module Vsphere
3
+ class Compute
4
4
  class Real
5
5
  def vm_reconfig_memory(options = {})
6
6
  raise ArgumentError, 'memory is a required parameter' unless options.key? 'memory'
@@ -1,6 +1,6 @@
1
1
  module Fog
2
- module Compute
3
- class Vsphere
2
+ module Vsphere
3
+ class Compute
4
4
  class Real
5
5
  def vm_reconfig_volumes(options = {})
6
6
  raise ArgumentError, 'instance_uuid is a required parameter' unless options.key? 'instance_uuid'
@@ -1,6 +1,6 @@
1
1
  module Fog
2
- module Compute
3
- class Vsphere
2
+ module Vsphere
3
+ class Compute
4
4
  class Real
5
5
  # Relocates a VM to different host or datastore.
6
6
  #
@@ -1,6 +1,6 @@
1
1
  module Fog
2
- module Compute
3
- class Vsphere
2
+ module Vsphere
3
+ class Compute
4
4
  class Real
5
5
  def vm_remove_snapshot(vm_id, snapshot_id, remove_children = false)
6
6
  vm = servers.get(vm_id)
@@ -1,6 +1,6 @@
1
1
  module Fog
2
- module Compute
3
- class Vsphere
2
+ module Vsphere
3
+ class Compute
4
4
  class Real
5
5
  def vm_rename(options = {})
6
6
  raise ArgumentError, 'name is a required parameter' unless options.key? 'name'
@@ -1,6 +1,6 @@
1
1
  module Fog
2
- module Compute
3
- class Vsphere
2
+ module Vsphere
3
+ class Compute
4
4
  class Real
5
5
  def vm_revert_snapshot(vm_id, snapshot_id)
6
6
  vm = servers.get(vm_id)
@@ -1,6 +1,6 @@
1
1
  module Fog
2
- module Compute
3
- class Vsphere
2
+ module Vsphere
3
+ class Compute
4
4
  class Real
5
5
  def vm_suspend(options = {})
6
6
  raise(ArgumentError, 'instance_uuid is a required parameter') unless options.key?('instance_uuid')
@@ -1,6 +1,6 @@
1
1
  module Fog
2
- module Compute
3
- class Vsphere
2
+ module Vsphere
3
+ class Compute
4
4
  class Real
5
5
  def vm_take_snapshot(options = {})
6
6
  raise ArgumentError, 'instance_uuid is a required parameter' unless options.key? 'instance_uuid'
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Vsphere
3
- VERSION = '2.5.0'.freeze
3
+ VERSION = '3.0.0'.freeze
4
4
  end
5
5
  end
@@ -1,6 +1,9 @@
1
1
  require 'simplecov'
2
2
  SimpleCov.start
3
3
 
4
+ require 'mocha/api'
5
+ Shindo::Tests.send(:include, Mocha::API)
6
+
4
7
  require 'minitest/autorun'
5
8
 
6
9
  require File.expand_path('../../lib/fog/vsphere', __FILE__)
@@ -5,14 +5,14 @@ Shindo.tests('Fog::Compute[:vsphere] | cluster collection', ['vsphere']) do
5
5
  clusters = compute.datacenters.first.clusters
6
6
 
7
7
  test('should not be empty') { !clusters.empty? }
8
- test('should be a kind of Fog::Compute::Vsphere::Clusters') { clusters.is_a? Fog::Compute::Vsphere::Clusters }
8
+ test('should be a kind of Fog::Vsphere::Compute::Clusters') { clusters.is_a? Fog::Vsphere::Compute::Clusters }
9
9
  test('should get a cluster') { clusters.get('Solutionscluster').id == '1d4d9a3f-e4e8-4c40-b7fc-263850068fa4' }
10
10
  end
11
11
 
12
12
  tests('A cluster should') do
13
13
  cluster = compute.datacenters.first.clusters.get('Solutionscluster')
14
14
 
15
- test('have datastores') { cluster.datastores.first.is_a? Fog::Compute::Vsphere::Datastore }
16
- test('have networks') { cluster.networks.first.is_a? Fog::Compute::Vsphere::Network }
15
+ test('have datastores') { cluster.datastores.first.is_a? Fog::Vsphere::Compute::Datastore }
16
+ test('have networks') { cluster.networks.first.is_a? Fog::Vsphere::Compute::Network }
17
17
  end
18
18
  end
@@ -5,7 +5,7 @@ Shindo.tests('Fog::Compute[:vsphere] | hosts collection', ['vsphere']) do
5
5
 
6
6
  tests('The hosts collection') do
7
7
  test('should not be empty') { !hosts.empty? }
8
- test('should be a kind of Fog::Compute::Vsphere::Hosts') { hosts.is_a? Fog::Compute::Vsphere::Hosts }
8
+ test('should be a kind of Fog::Vsphere::Compute::Hosts') { hosts.is_a? Fog::Vsphere::Compute::Hosts }
9
9
  test('should get hosts') { hosts.get('host1.example.com').name == 'host1.example.com' }
10
10
  end
11
11
  end
@@ -6,7 +6,7 @@ Shindo.tests('Fog::Compute[:vsphere] | rules collection', ['vsphere']) do
6
6
 
7
7
  tests('The rules collection') do
8
8
  test('should not be empty') { !rules.empty? }
9
- test('should be a kind of Fog::Compute::Vsphere::Rules') { rules.is_a? Fog::Compute::Vsphere::Rules }
9
+ test('should be a kind of Fog::Vsphere::Compute::Rules') { rules.is_a? Fog::Vsphere::Compute::Rules }
10
10
  test('should get rules') { rules.get('anti-affinity-foo').key == 4242 }
11
11
  test('should destroy rules') { rules.first.destroy; rules.reload; rules.empty? }
12
12
  test('should create rules') do
@@ -18,12 +18,12 @@ Shindo.tests('Fog::Compute[:vsphere] | server model', ['vsphere']) do
18
18
  end
19
19
  test('snapshots') do
20
20
  test('responds') { server.respond_to? 'snapshots' }
21
- test('returns successfully') { server.snapshots.is_a? Fog::Compute::Vsphere::Snapshots }
21
+ test('returns successfully') { server.snapshots.is_a? Fog::Vsphere::Compute::Snapshots }
22
22
  end
23
23
  test('find_snapshot') do
24
24
  test('responds') { server.respond_to? 'find_snapshot' }
25
25
  test('returns successfully') do
26
- server.find_snapshot('snapshot-0101').is_a? Fog::Compute::Vsphere::Snapshot
26
+ server.find_snapshot('snapshot-0101').is_a? Fog::Vsphere::Compute::Snapshot
27
27
  end
28
28
  test('returns correct snapshot') do
29
29
  server.find_snapshot('snapshot-0101').ref == 'snapshot-0101'
@@ -39,7 +39,7 @@ Shindo.tests('Fog::Compute[:vsphere] | server model', ['vsphere']) do
39
39
  end
40
40
  end
41
41
  test('tickets') do
42
- test('acquire ticket successfully') { server.acquire_ticket.is_a? Fog::Compute::Vsphere::Ticket }
42
+ test('acquire ticket successfully') { server.acquire_ticket.is_a? Fog::Vsphere::Compute::Ticket }
43
43
  end
44
44
  end
45
45
  tests('have attributes') do
@@ -69,6 +69,6 @@ Shindo.tests('Fog::Compute[:vsphere] | server model', ['vsphere']) do
69
69
  end
70
70
  end
71
71
  end
72
- test('be a kind of Fog::Compute::Vsphere::Server') { server.is_a? Fog::Compute::Vsphere::Server }
72
+ test('be a kind of Fog::Vsphere::Compute::Server') { server.is_a? Fog::Vsphere::Compute::Server }
73
73
  end
74
74
  end
@@ -4,7 +4,7 @@ require 'fog/vsphere/models/compute/server'
4
4
 
5
5
  class TestServer < Minitest::Test
6
6
  def test_tools_installed
7
- server = Fog::Compute::Vsphere::Server.new
7
+ server = Fog::Vsphere::Compute::Server.new
8
8
  server.tools_state = 'toolsNotRunning'
9
9
  server.tools_version = 'guestToolsNotInstalled'
10
10
 
@@ -3,7 +3,7 @@ Shindo.tests('Fog::Compute[:vsphere] | servers collection', ['vsphere']) do
3
3
 
4
4
  tests('The servers collection') do
5
5
  test('should not be empty') { !servers.empty? }
6
- test('should be a kind of Fog::Compute::Vsphere::Servers') { servers.is_a? Fog::Compute::Vsphere::Servers }
6
+ test('should be a kind of Fog::Vsphere::Compute::Servers') { servers.is_a? Fog::Vsphere::Compute::Servers }
7
7
  tests('should be able to reload itself').succeeds { servers.reload }
8
8
  tests('should be able to get a model') do
9
9
  tests('by managed object reference').succeeds { servers.get 'jefftest' }
@@ -3,6 +3,6 @@ Shindo.tests('Fog::Compute[:vsphere] | hosts collection', ['vsphere']) do
3
3
  server = service.servers.last
4
4
 
5
5
  tests('The tickets collection') do
6
- test('should create a ticket for a server') { service.tickets(server: server).create.is_a? Fog::Compute::Vsphere::Ticket }
6
+ test('should create a ticket for a server') { service.tickets(server: server).create.is_a? Fog::Vsphere::Compute::Ticket }
7
7
  end
8
8
  end
@@ -3,24 +3,32 @@ require 'ostruct'
3
3
  Shindo.tests('Fog::Compute[:vsphere] | get_network request', ['vsphere']) do
4
4
  compute = Fog::Compute[:vsphere]
5
5
 
6
- class DistributedVirtualPortgroup
7
- attr_accessor :name, :dvs_name, :key
8
-
9
- def initialize(attrs)
10
- @name = attrs.fetch(:name)
11
- @dvs_name = attrs.fetch(:dvs_name)
12
- @key = attrs.fetch(:key)
13
- end
6
+ before do
7
+ mocha_setup
8
+ end
9
+ after do
10
+ mocha_teardown
11
+ end
14
12
 
15
- def config
16
- OpenStruct.new(distributedVirtualSwitch: OpenStruct.new(name: dvs_name))
17
- end
13
+ def make_fake_dvs(args = {})
14
+ config = OpenStruct.new(
15
+ distributedVirtualSwitch: OpenStruct.new(name: args[:dvs_name])
16
+ )
17
+ network = stub(args.merge(config: config))
18
+ network.expects('is_a?')
19
+ .with(RbVmomi::VIM::DistributedVirtualPortgroup)
20
+ .returns(true)
21
+ network
18
22
  end
19
23
 
20
- fake_networks = [OpenStruct.new(name: 'non-dvs'),
21
- DistributedVirtualPortgroup.new(name: 'web1', dvs_name: 'dvs5', key: '4001'),
22
- DistributedVirtualPortgroup.new(name: 'web1', dvs_name: 'dvs11', key: '4001'),
23
- DistributedVirtualPortgroup.new(name: 'other', dvs_name: 'other', key: '4001')]
24
+ def fake_networks
25
+ [
26
+ OpenStruct.new(name: 'non-dvs'),
27
+ make_fake_dvs(name: 'web1', dvs_name: 'dvs5', key: '4001'),
28
+ make_fake_dvs(name: 'web1', dvs_name: 'dvs11', key: '4001'),
29
+ make_fake_dvs(name: 'other', dvs_name: 'other', key: '4001')
30
+ ]
31
+ end
24
32
 
25
33
  tests('#choose_finder should') do
26
34
  test('choose the network based on network name and dvs name') do
@@ -2,7 +2,7 @@ Shindo.tests('Fog::Compute[:vsphere] | revert_to_snapshot request', ['vsphere'])
2
2
  compute = Fog::Compute[:vsphere]
3
3
 
4
4
  tests('The response should') do
5
- response = compute.revert_to_snapshot(Fog::Compute::Vsphere::Snapshot.new(service: 1))
5
+ response = compute.revert_to_snapshot(Fog::Vsphere::Compute::Snapshot.new(service: 1))
6
6
  test('be a kind of Hash') { response.is_a? Hash }
7
7
  test('should have a task_state key') { response.key? 'state' }
8
8
  end
@@ -2,7 +2,7 @@ require 'ostruct'
2
2
 
3
3
  Shindo.tests('Fog::Compute[:vsphere] | update_vm request', 'vsphere') do
4
4
  compute = Fog::Compute[:vsphere]
5
- server = Fog::Compute::Vsphere::Server.new
5
+ server = Fog::Vsphere::Compute::Server.new
6
6
 
7
7
  tests('UPDATE vm | The return value should') do
8
8
  response = compute.update_vm(server)
@@ -1,4 +1,4 @@
1
- Shindo.tests('Fog::Compute[:vsphere] | vm_clone request', 'vsphere') do
1
+ Shindo.tests('Fog::Compute[:vsphere] | vm_clone request', ['vsphere']) do
2
2
  # require 'guid'
3
3
  compute = Fog::Compute[:vsphere]
4
4
  response = nil
@@ -6,10 +6,15 @@ Shindo.tests('Fog::Compute[:vsphere] | vm_clone request', 'vsphere') do
6
6
 
7
7
  template = 'rhel64'
8
8
  datacenter = 'Solutions'
9
+ default_params = {
10
+ 'datacenter' => datacenter,
11
+ 'template_path' => template,
12
+ 'resource_pool' => ['Solutionscluster', 'Resources']
13
+ }
9
14
 
10
15
  tests('Standard Clone | The return value should') do
11
16
  servers_size = compute.servers.size
12
- response = compute.vm_clone('datacenter' => datacenter, 'template_path' => template, 'name' => 'cloning_vm', 'wait' => true)
17
+ response = compute.vm_clone(default_params.merge('name' => 'cloning_vm', 'wait' => true))
13
18
  test('be a kind of Hash') { response.is_a? Hash }
14
19
  %w[vm_ref new_vm task_ref].each do |key|
15
20
  test("have a #{key} key") { response.key? key }
@@ -20,7 +25,7 @@ Shindo.tests('Fog::Compute[:vsphere] | vm_clone request', 'vsphere') do
20
25
 
21
26
  tests('Standard Clone setting ram and cpu | The return value should') do
22
27
  servers_size = compute.servers.size
23
- response = compute.vm_clone('datacenter' => datacenter, 'template_path' => template, 'name' => 'cloning_vm', 'memoryMB' => '8192', 'numCPUs' => '8', 'wait' => true)
28
+ response = compute.vm_clone(default_params.merge('name' => 'cloning_vm', 'memoryMB' => '8192', 'numCPUs' => '8', 'wait' => true))
24
29
  test('be a kind of Hash') { response.is_a? Hash }
25
30
  %w[vm_ref new_vm task_ref].each do |key|
26
31
  test("have a #{key} key") { response.key? key }
@@ -31,7 +36,7 @@ Shindo.tests('Fog::Compute[:vsphere] | vm_clone request', 'vsphere') do
31
36
 
32
37
  tests('Linked Clone | The return value should') do
33
38
  servers_size = compute.servers.size
34
- response = compute.vm_clone('datacenter' => datacenter, 'template_path' => template, 'name' => 'cloning_vm_linked', 'wait' => 1, 'linked_clone' => true)
39
+ response = compute.vm_clone(default_params.merge('name' => 'cloning_vm_linked', 'wait' => 1, 'linked_clone' => true))
35
40
  test('be a kind of Hash') { response.is_a? Hash }
36
41
  %w[vm_ref new_vm task_ref].each do |key|
37
42
  test("have a #{key} key") { response.key? key }
@@ -42,7 +47,7 @@ Shindo.tests('Fog::Compute[:vsphere] | vm_clone request', 'vsphere') do
42
47
 
43
48
  tests('When invalid input is presented') do
44
49
  raises(ArgumentError, 'it should raise ArgumentError') { compute.vm_clone(foo: 1) }
45
- raises(Fog::Compute::Vsphere::NotFound, 'it should raise Fog::Compute::Vsphere::NotFound when the UUID is not a string') do
50
+ raises(Fog::Vsphere::Compute::NotFound, 'it should raise Fog::Vsphere::Compute::NotFound when the UUID is not a string') do
46
51
  pending # require 'guid'
47
52
  compute.vm_clone('instance_uuid' => Guid.from_s(template), 'name' => 'jefftestfoo')
48
53
  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: 2.5.0
4
+ version: 3.0.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: 2018-11-16 00:00:00.000000000 Z
11
+ date: 2019-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core
@@ -28,16 +28,22 @@ dependencies:
28
28
  name: rbvmomi
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.9'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '3'
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: '1.9'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '3'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: bundler
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +114,20 @@ dependencies:
108
114
  - - "~>"
109
115
  - !ruby/object:Gem::Version
110
116
  version: 0.50.0
117
+ - !ruby/object:Gem::Dependency
118
+ name: mocha
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '1.8'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '1.8'
111
131
  - !ruby/object:Gem::Dependency
112
132
  name: shindo
113
133
  requirement: !ruby/object:Gem::Requirement
@@ -142,6 +162,7 @@ files:
142
162
  - README.md
143
163
  - Rakefile
144
164
  - fog-vsphere.gemspec
165
+ - lib/fog-vsphere.rb
145
166
  - lib/fog/bin/vsphere.rb
146
167
  - lib/fog/vsphere.rb
147
168
  - lib/fog/vsphere/compute.rb
@@ -328,7 +349,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
328
349
  version: '0'
329
350
  requirements: []
330
351
  rubyforge_project:
331
- rubygems_version: 2.7.7
352
+ rubygems_version: 2.7.3
332
353
  signing_key:
333
354
  specification_version: 4
334
355
  summary: Module for the 'fog' gem to support VMware vSphere.