fog-vsphere 2.1.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +8 -0
  3. data/.rubocop_todo.yml +217 -0
  4. data/.travis.yml +1 -0
  5. data/CHANGELOG.md +4 -0
  6. data/Rakefile +10 -1
  7. data/fog-vsphere.gemspec +2 -2
  8. data/lib/fog/bin/vsphere.rb +1 -1
  9. data/lib/fog/vsphere/compute.rb +320 -301
  10. data/lib/fog/vsphere/models/compute/cdrom.rb +10 -10
  11. data/lib/fog/vsphere/models/compute/cdroms.rb +2 -2
  12. data/lib/fog/vsphere/models/compute/cluster.rb +20 -20
  13. data/lib/fog/vsphere/models/compute/clusters.rb +1 -1
  14. data/lib/fog/vsphere/models/compute/customfields.rb +4 -4
  15. data/lib/fog/vsphere/models/compute/customvalues.rb +8 -8
  16. data/lib/fog/vsphere/models/compute/datacenter.rb +16 -16
  17. data/lib/fog/vsphere/models/compute/datastores.rb +1 -1
  18. data/lib/fog/vsphere/models/compute/folder.rb +2 -2
  19. data/lib/fog/vsphere/models/compute/folders.rb +2 -2
  20. data/lib/fog/vsphere/models/compute/hosts.rb +4 -4
  21. data/lib/fog/vsphere/models/compute/interface.rb +12 -12
  22. data/lib/fog/vsphere/models/compute/interfaces.rb +14 -16
  23. data/lib/fog/vsphere/models/compute/interfacetype.rb +2 -2
  24. data/lib/fog/vsphere/models/compute/interfacetypes.rb +6 -8
  25. data/lib/fog/vsphere/models/compute/networks.rb +1 -1
  26. data/lib/fog/vsphere/models/compute/resource_pools.rb +1 -1
  27. data/lib/fog/vsphere/models/compute/rule.rb +8 -9
  28. data/lib/fog/vsphere/models/compute/rules.rb +9 -10
  29. data/lib/fog/vsphere/models/compute/scsicontroller.rb +1 -1
  30. data/lib/fog/vsphere/models/compute/server.rb +68 -80
  31. data/lib/fog/vsphere/models/compute/servers.rb +12 -13
  32. data/lib/fog/vsphere/models/compute/servertype.rb +6 -6
  33. data/lib/fog/vsphere/models/compute/servertypes.rb +2 -2
  34. data/lib/fog/vsphere/models/compute/snapshot.rb +5 -6
  35. data/lib/fog/vsphere/models/compute/snapshots.rb +1 -1
  36. data/lib/fog/vsphere/models/compute/ticket.rb +0 -1
  37. data/lib/fog/vsphere/models/compute/volume.rb +12 -14
  38. data/lib/fog/vsphere/models/compute/volumes.rb +10 -10
  39. data/lib/fog/vsphere/requests/compute/cloudinit_to_customspec.rb +8 -8
  40. data/lib/fog/vsphere/requests/compute/create_folder.rb +5 -5
  41. data/lib/fog/vsphere/requests/compute/create_group.rb +16 -16
  42. data/lib/fog/vsphere/requests/compute/create_rule.rb +13 -13
  43. data/lib/fog/vsphere/requests/compute/create_vm.rb +117 -119
  44. data/lib/fog/vsphere/requests/compute/destroy_group.rb +8 -8
  45. data/lib/fog/vsphere/requests/compute/destroy_rule.rb +8 -8
  46. data/lib/fog/vsphere/requests/compute/folder_destroy.rb +3 -3
  47. data/lib/fog/vsphere/requests/compute/get_cluster.rb +2 -2
  48. data/lib/fog/vsphere/requests/compute/get_compute_resource.rb +16 -16
  49. data/lib/fog/vsphere/requests/compute/get_datacenter.rb +7 -7
  50. data/lib/fog/vsphere/requests/compute/get_datastore.rb +1 -2
  51. data/lib/fog/vsphere/requests/compute/get_folder.rb +24 -24
  52. data/lib/fog/vsphere/requests/compute/get_host.rb +2 -3
  53. data/lib/fog/vsphere/requests/compute/get_interface_type.rb +6 -6
  54. data/lib/fog/vsphere/requests/compute/get_network.rb +7 -10
  55. data/lib/fog/vsphere/requests/compute/get_resource_pool.rb +1 -2
  56. data/lib/fog/vsphere/requests/compute/get_server_type.rb +14 -14
  57. data/lib/fog/vsphere/requests/compute/get_storage_pod.rb +2 -2
  58. data/lib/fog/vsphere/requests/compute/get_template.rb +1 -2
  59. data/lib/fog/vsphere/requests/compute/get_virtual_machine.rb +26 -26
  60. data/lib/fog/vsphere/requests/compute/get_vm_first_scsi_controller.rb +6 -7
  61. data/lib/fog/vsphere/requests/compute/host_finish_maintenance.rb +1 -1
  62. data/lib/fog/vsphere/requests/compute/host_shutdown.rb +1 -1
  63. data/lib/fog/vsphere/requests/compute/host_start_maintenance.rb +1 -1
  64. data/lib/fog/vsphere/requests/compute/list_child_snapshots.rb +37 -39
  65. data/lib/fog/vsphere/requests/compute/list_clusters.rb +8 -9
  66. data/lib/fog/vsphere/requests/compute/list_compute_resources.rb +57 -59
  67. data/lib/fog/vsphere/requests/compute/list_customfields.rb +5 -6
  68. data/lib/fog/vsphere/requests/compute/list_datacenters.rb +17 -17
  69. data/lib/fog/vsphere/requests/compute/list_datastores.rb +16 -15
  70. data/lib/fog/vsphere/requests/compute/list_folders.rb +4 -4
  71. data/lib/fog/vsphere/requests/compute/list_groups.rb +5 -5
  72. data/lib/fog/vsphere/requests/compute/list_hosts.rb +30 -14
  73. data/lib/fog/vsphere/requests/compute/list_interface_types.rb +7 -7
  74. data/lib/fog/vsphere/requests/compute/list_networks.rb +12 -16
  75. data/lib/fog/vsphere/requests/compute/list_processes.rb +14 -14
  76. data/lib/fog/vsphere/requests/compute/list_resource_pools.rb +13 -14
  77. data/lib/fog/vsphere/requests/compute/list_rules.rb +4 -4
  78. data/lib/fog/vsphere/requests/compute/list_server_types.rb +24 -26
  79. data/lib/fog/vsphere/requests/compute/list_storage_pods.rb +8 -8
  80. data/lib/fog/vsphere/requests/compute/list_templates.rb +4 -5
  81. data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +15 -15
  82. data/lib/fog/vsphere/requests/compute/list_vm_cdroms.rb +16 -12
  83. data/lib/fog/vsphere/requests/compute/list_vm_customvalues.rb +3 -4
  84. data/lib/fog/vsphere/requests/compute/list_vm_interfaces.rb +54 -56
  85. data/lib/fog/vsphere/requests/compute/list_vm_scsi_controllers.rb +7 -7
  86. data/lib/fog/vsphere/requests/compute/list_vm_snapshots.rb +36 -36
  87. data/lib/fog/vsphere/requests/compute/list_vm_volumes.rb +43 -36
  88. data/lib/fog/vsphere/requests/compute/modify_vm_cdrom.rb +4 -4
  89. data/lib/fog/vsphere/requests/compute/modify_vm_controller.rb +2 -2
  90. data/lib/fog/vsphere/requests/compute/modify_vm_interface.rb +26 -19
  91. data/lib/fog/vsphere/requests/compute/modify_vm_volume.rb +7 -7
  92. data/lib/fog/vsphere/requests/compute/revert_to_snapshot.rb +2 -2
  93. data/lib/fog/vsphere/requests/compute/set_vm_customvalue.rb +2 -2
  94. data/lib/fog/vsphere/requests/compute/update_vm.rb +111 -0
  95. data/lib/fog/vsphere/requests/compute/upload_iso.rb +10 -10
  96. data/lib/fog/vsphere/requests/compute/vm_acquire_ticket.rb +3 -3
  97. data/lib/fog/vsphere/requests/compute/vm_clone.rb +245 -247
  98. data/lib/fog/vsphere/requests/compute/vm_config_vnc.rb +15 -15
  99. data/lib/fog/vsphere/requests/compute/vm_destroy.rb +2 -2
  100. data/lib/fog/vsphere/requests/compute/vm_execute.rb +16 -16
  101. data/lib/fog/vsphere/requests/compute/vm_migrate.rb +11 -11
  102. data/lib/fog/vsphere/requests/compute/vm_power_off.rb +8 -8
  103. data/lib/fog/vsphere/requests/compute/vm_power_on.rb +2 -2
  104. data/lib/fog/vsphere/requests/compute/vm_reboot.rb +5 -5
  105. data/lib/fog/vsphere/requests/compute/vm_reconfig_cdrom.rb +11 -11
  106. data/lib/fog/vsphere/requests/compute/vm_reconfig_cpus.rb +8 -8
  107. data/lib/fog/vsphere/requests/compute/vm_reconfig_hardware.rb +6 -6
  108. data/lib/fog/vsphere/requests/compute/vm_reconfig_memory.rb +8 -8
  109. data/lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb +14 -16
  110. data/lib/fog/vsphere/requests/compute/vm_relocate.rb +8 -8
  111. data/lib/fog/vsphere/requests/compute/vm_remove_snapshot.rb +2 -2
  112. data/lib/fog/vsphere/requests/compute/vm_rename.rb +5 -5
  113. data/lib/fog/vsphere/requests/compute/vm_revert_snapshot.rb +1 -1
  114. data/lib/fog/vsphere/requests/compute/vm_take_snapshot.rb +8 -8
  115. data/lib/fog/vsphere/version.rb +1 -1
  116. data/tests/compute_tests.rb +16 -17
  117. data/tests/helpers/mock_helper.rb +3 -3
  118. data/tests/models/compute/cluster_tests.rb +4 -5
  119. data/tests/models/compute/hosts_tests.rb +2 -4
  120. data/tests/models/compute/rules_tests.rb +10 -16
  121. data/tests/models/compute/server_tests.rb +30 -31
  122. data/tests/models/compute/servers_tests.rb +2 -4
  123. data/tests/models/compute/ticket_tests.rb +4 -6
  124. data/tests/models/compute/tickets_tests.rb +1 -3
  125. data/tests/requests/compute/current_time_tests.rb +2 -4
  126. data/tests/requests/compute/folder_destroy_tests.rb +5 -7
  127. data/tests/requests/compute/get_network_tests.rb +20 -23
  128. data/tests/requests/compute/list_child_snapshots_tests.rb +1 -2
  129. data/tests/requests/compute/list_clusters_tests.rb +5 -6
  130. data/tests/requests/compute/list_datastores_tests.rb +6 -7
  131. data/tests/requests/compute/list_hosts_tests.rb +3 -4
  132. data/tests/requests/compute/list_networks_tests.rb +6 -7
  133. data/tests/requests/compute/list_storage_pods_test.rb +3 -4
  134. data/tests/requests/compute/list_virtual_machines_tests.rb +16 -20
  135. data/tests/requests/compute/list_vm_cdroms_tests.rb +1 -2
  136. data/tests/requests/compute/list_vm_snapshots_tests.rb +1 -2
  137. data/tests/requests/compute/modify_vm_cdrom_tests.rb +3 -4
  138. data/tests/requests/compute/revert_to_snapshot_tests.rb +2 -4
  139. data/tests/requests/compute/set_vm_customvalue_tests.rb +0 -2
  140. data/tests/requests/compute/update_vm_tests.rb +13 -0
  141. data/tests/requests/compute/vm_clone_tests.rb +20 -20
  142. data/tests/requests/compute/vm_config_vnc_tests.rb +3 -4
  143. data/tests/requests/compute/vm_destroy_tests.rb +1 -4
  144. data/tests/requests/compute/vm_migrate_tests.rb +1 -2
  145. data/tests/requests/compute/vm_power_off_tests.rb +2 -4
  146. data/tests/requests/compute/vm_power_on_tests.rb +1 -3
  147. data/tests/requests/compute/vm_reboot_tests.rb +2 -4
  148. data/tests/requests/compute/vm_reconfig_cdrom_tests.rb +2 -3
  149. data/tests/requests/compute/vm_reconfig_cpus_tests.rb +1 -3
  150. data/tests/requests/compute/vm_reconfig_hardware_tests.rb +2 -4
  151. data/tests/requests/compute/vm_reconfig_memory_tests.rb +1 -3
  152. data/tests/requests/compute/vm_take_snapshot_tests.rb +1 -3
  153. metadata +9 -4
@@ -1,10 +1,8 @@
1
1
  Shindo.tests('Fog::Compute[:vsphere] | hosts collection', ['vsphere']) do
2
-
3
2
  service = Fog::Compute[:vsphere]
4
3
  server = service.servers.last
5
4
 
6
5
  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 }
6
+ test('should create a ticket for a server') { service.tickets(server: server).create.is_a? Fog::Compute::Vsphere::Ticket }
8
7
  end
9
-
10
8
  end
@@ -1,12 +1,10 @@
1
1
  Shindo.tests('Fog::Compute[:vsphere] | current_time request', ['vsphere']) do
2
-
3
2
  compute = Fog::Compute[:vsphere]
4
3
 
5
4
  tests('The response should') do
6
5
  response = compute.current_time
7
- test('be a kind of Hash') { response.kind_of? Hash }
6
+ test('be a kind of Hash') { response.is_a? Hash }
8
7
  test('have a current_time key') { response.key? 'current_time' }
9
- test('have a current_time key with a Time value') { response['current_time'].kind_of? Time }
8
+ test('have a current_time key with a Time value') { response['current_time'].is_a? Time }
10
9
  end
11
-
12
10
  end
@@ -1,21 +1,19 @@
1
1
  Shindo.tests('Fog::Compute[:vsphere] | folder_destroy request', ['vsphere']) do
2
-
3
2
  compute = Fog::Compute[:vsphere]
4
3
 
5
- empty_folder = "/Solutions/empty"
6
- full_folder = "/Solutions/wibble"
7
- datacenter = "Solutions"
4
+ empty_folder = '/Solutions/empty'
5
+ full_folder = '/Solutions/wibble'
6
+ datacenter = 'Solutions'
8
7
 
9
8
  tests('The response should') do
10
9
  response = compute.folder_destroy(empty_folder, datacenter)
11
- test('be a kind of Hash') { response.kind_of? Hash }
10
+ test('be a kind of Hash') { response.is_a? Hash }
12
11
  test('should have a task_state key') { response.key? 'task_state' }
13
12
  end
14
-
13
+
15
14
  tests('When folder is not empty') do
16
15
  raises(Fog::Vsphere::Errors::ServiceError, 'raises ServiceError') do
17
16
  compute.folder_destroy(full_folder, datacenter)
18
17
  end
19
18
  end
20
-
21
19
  end
@@ -1,50 +1,47 @@
1
1
  require 'ostruct'
2
2
 
3
3
  Shindo.tests('Fog::Compute[:vsphere] | get_network request', ['vsphere']) do
4
-
5
4
  compute = Fog::Compute[:vsphere]
6
5
 
7
-
8
6
  class DistributedVirtualPortgroup
9
- attr_accessor :name, :dvs_name
7
+ attr_accessor :name, :dvs_name, :key
10
8
 
11
- def initialize attrs
9
+ def initialize(attrs)
12
10
  @name = attrs.fetch(:name)
13
11
  @dvs_name = attrs.fetch(:dvs_name)
12
+ @key = attrs.fetch(:key)
14
13
  end
15
14
 
16
15
  def config
17
- OpenStruct.new( :distributedVirtualSwitch => OpenStruct.new(:name => dvs_name))
16
+ OpenStruct.new(distributedVirtualSwitch: OpenStruct.new(name: dvs_name))
18
17
  end
19
18
  end
20
19
 
21
- fake_networks = [OpenStruct.new(:name => 'non-dvs'),
22
- DistributedVirtualPortgroup.new( :name => 'web1', :dvs_name => 'dvs5'),
23
- DistributedVirtualPortgroup.new( :name => 'web1', :dvs_name => 'dvs11'),
24
- DistributedVirtualPortgroup.new( :name => 'other', :dvs_name => 'other'),
25
- ]
26
-
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')]
27
24
 
28
25
  tests('#choose_finder should') do
29
- test('choose the network based on network name and dvs name'){
26
+ test('choose the network based on network name and dvs name') do
30
27
  finder = compute.send(:choose_finder, 'web1', 'dvs11')
31
- found_network = fake_networks.find{ |n| finder.call(n) }
28
+ found_network = fake_networks.find { |n| finder.call(n) }
32
29
  found_network.name == 'web1' && found_network.dvs_name == 'dvs11'
33
- }
34
- test('choose the network based on network name and any dvs'){
30
+ end
31
+ test('choose the network based on network name and any dvs') do
35
32
  finder = compute.send(:choose_finder, 'web1', :dvs)
36
- found_network = fake_networks.find{ |n| finder.call(n) }
33
+ found_network = fake_networks.find { |n| finder.call(n) }
37
34
  found_network.name == 'web1' && found_network.dvs_name == 'dvs5'
38
- }
39
- test('choose the network based on network name only'){
35
+ end
36
+ test('choose the network based on network name only') do
40
37
  finder = compute.send(:choose_finder, 'other', nil)
41
- found_network = fake_networks.find{ |n| finder.call(n) }
38
+ found_network = fake_networks.find { |n| finder.call(n) }
42
39
  found_network.name == 'other' && found_network.dvs_name == 'other'
43
- }
44
- test('choose the network based on network name only for non-dvs'){
40
+ end
41
+ test('choose the network based on network name only for non-dvs') do
45
42
  finder = compute.send(:choose_finder, 'non-dvs', nil)
46
- found_network = fake_networks.find{ |n| finder.call(n) }
43
+ found_network = fake_networks.find { |n| finder.call(n) }
47
44
  found_network.name == 'non-dvs' && found_network.class.name.to_s == 'OpenStruct'
48
- }
45
+ end
49
46
  end
50
47
  end
@@ -1,10 +1,9 @@
1
1
  Shindo.tests('Fog::Compute[:vsphere] | list_child_snapshots request', ['vsphere']) do
2
-
3
2
  compute = Fog::Compute[:vsphere]
4
3
 
5
4
  tests('The response should') do
6
5
  response = compute.list_child_snapshots('snapshot-0101')
7
- test('be a kind of Array') { response.kind_of? Array }
6
+ test('be a kind of Array') { response.is_a? Array }
8
7
  test('it should contains Hashes') { response.all? { |i| Hash === i } }
9
8
  end
10
9
  end
@@ -1,11 +1,10 @@
1
1
  Shindo.tests('Fog::Compute[:vsphere] | list_clusters request', ['vsphere']) do
2
- tests("When listing all clusters") do
3
-
2
+ tests('When listing all clusters') do
4
3
  response = Fog::Compute[:vsphere].list_clusters
5
- test("Clusters extracted from folders... ") {response.length == 4}
4
+ test('Clusters extracted from folders... ') { response.length == 4 }
6
5
 
7
- tests("The response data format ...") do
8
- test("be a kind of Hash") { response.kind_of? Array }
6
+ tests('The response data format ...') do
7
+ test('be a kind of Hash') { response.is_a? Array }
9
8
  end
10
9
  end
11
- end
10
+ end
@@ -1,18 +1,17 @@
1
1
  Shindo.tests('Fog::Compute[:vsphere] | list_datastores request', ['vsphere']) do
2
-
3
2
  compute = Fog::Compute[:vsphere]
4
3
 
5
4
  tests('The response with datastore filter should') do
6
- response = compute.list_datastores(:datacenter => 'Solutions')
7
- test('be a kind of Array') { response.kind_of? Array }
5
+ response = compute.list_datastores(datacenter: 'Solutions')
6
+ test('be a kind of Array') { response.is_a? Array }
8
7
  test('contain Hashes') { response.all? { |i| Hash === i } }
9
- test("have 2 elements") {response.length == 2}
8
+ test('have 2 elements') { response.length == 2 }
10
9
  end
11
10
 
12
11
  tests('The response with cluster filter should') do
13
- response = compute.list_datastores(:datacenter => 'Solutions', :cluster => 'Solutionscluster')
14
- test('be a kind of Array') { response.kind_of? Array }
12
+ response = compute.list_datastores(datacenter: 'Solutions', cluster: 'Solutionscluster')
13
+ test('be a kind of Array') { response.is_a? Array }
15
14
  test('contain Hashes') { response.all? { |i| Hash === i } }
16
- test("have a single element") {response.length == 1}
15
+ test('have a single element') { response.length == 1 }
17
16
  end
18
17
  end
@@ -1,11 +1,10 @@
1
1
  Shindo.tests('Fog::Compute[:vsphere] | list_hosts request', ['vsphere']) do
2
-
3
2
  compute = Fog::Compute[:vsphere]
4
3
 
5
4
  tests('The response should') do
6
- response = compute.list_hosts(:datacenter => 'Solutions', :cluster => 'Solutionscluster')
7
- test('be a kind of Array') { response.kind_of? Array }
5
+ response = compute.list_hosts(datacenter: 'Solutions', cluster: 'Solutionscluster')
6
+ test('be a kind of Array') { response.is_a? Array }
8
7
  test('contain Hashes') { response.all? { |i| Hash === i } }
9
- test("have 1 element") {response.length == 1}
8
+ test('have 1 element') { response.length == 1 }
10
9
  end
11
10
  end
@@ -1,18 +1,17 @@
1
1
  Shindo.tests('Fog::Compute[:vsphere] | list_networks request', ['vsphere']) do
2
-
3
2
  compute = Fog::Compute[:vsphere]
4
3
 
5
4
  tests('The response with datastore filter should') do
6
- response = compute.list_networks(:datacenter => 'Solutions')
7
- test('be a kind of Array') { response.kind_of? Array }
5
+ response = compute.list_networks(datacenter: 'Solutions')
6
+ test('be a kind of Array') { response.is_a? Array }
8
7
  test('contain Hashes') { response.all? { |i| Hash === i } }
9
- test("have 2 elements") {response.length == 2}
8
+ test('have 2 elements') { response.length == 2 }
10
9
  end
11
10
 
12
11
  tests('The response with cluster filter should') do
13
- response = compute.list_networks(:datacenter => 'Solutions', :cluster => 'Solutionscluster')
14
- test('be a kind of Array') { response.kind_of? Array }
12
+ response = compute.list_networks(datacenter: 'Solutions', cluster: 'Solutionscluster')
13
+ test('be a kind of Array') { response.is_a? Array }
15
14
  test('contain Hashes') { response.all? { |i| Hash === i } }
16
- test("have a single element") {response.length == 1}
15
+ test('have a single element') { response.length == 1 }
17
16
  end
18
17
  end
@@ -1,10 +1,9 @@
1
1
  Shindo.tests('Fog::Compute[:vsphere] | list_storage_pods request', ['vsphere']) do
2
- tests("When listing all storage pods") do
3
-
2
+ tests('When listing all storage pods') do
4
3
  response = Fog::Compute[:vsphere].list_storage_pods
5
4
 
6
- tests("The response data format ...") do
7
- test("be a kind of Hash") { response.kind_of? Array }
5
+ tests('The response data format ...') do
6
+ test('be a kind of Hash') { response.is_a? Array }
8
7
  end
9
8
  end
10
9
  end
@@ -1,38 +1,34 @@
1
1
  Shindo.tests('Fog::Compute[:vsphere] | list_virtual_machines request', ['vsphere']) do
2
-
3
- tests("When listing all machines") do
4
-
2
+ tests('When listing all machines') do
5
3
  response = Fog::Compute[:vsphere].list_virtual_machines
6
4
 
7
- tests("The response data format ...") do
8
- test("be a kind of Hash") { response.kind_of? Array }
5
+ tests('The response data format ...') do
6
+ test('be a kind of Hash') { response.is_a? Array }
9
7
  end
10
8
  end
11
9
 
12
- tests("When providing an instance_uuid") do
13
-
10
+ tests('When providing an instance_uuid') do
14
11
  # pending unless Fog.mock?
15
12
 
16
- tests("that does exist") do
17
- uuid = "5029c440-85ee-c2a1-e9dd-b63e39364603"
18
- response = Fog::Compute[:vsphere].list_virtual_machines({'instance_uuid' => uuid})
13
+ tests('that does exist') do
14
+ uuid = '5029c440-85ee-c2a1-e9dd-b63e39364603'
15
+ response = Fog::Compute[:vsphere].list_virtual_machines('instance_uuid' => uuid)
19
16
 
20
- tests("The response should") do
21
- test("contain one vm") { response.length == 1 }
22
- test("contain that is an attribute hash") { response[0].kind_of? Hash }
23
- test("find jefftest") { response.first['name'] == 'jefftest' }
17
+ tests('The response should') do
18
+ test('contain one vm') { response.length == 1 }
19
+ test('contain that is an attribute hash') { response[0].is_a? Hash }
20
+ test('find jefftest') { response.first['name'] == 'jefftest' }
24
21
  end
25
22
  end
26
23
 
27
- tests("that does not exist or is a template") do
28
- %w{ does-not-exist-and-is-not-a-uuid 50323f93-6835-1178-8b8f-9e2109890e1a }.each do |uuid|
29
- response = Fog::Compute[:vsphere].list_virtual_machines({'instance_uuid' => uuid})
24
+ tests('that does not exist or is a template') do
25
+ %w[does-not-exist-and-is-not-a-uuid 50323f93-6835-1178-8b8f-9e2109890e1a].each do |uuid|
26
+ response = Fog::Compute[:vsphere].list_virtual_machines('instance_uuid' => uuid)
30
27
 
31
- tests("The response should") do
32
- test("be empty") { response.empty? }
28
+ tests('The response should') do
29
+ test('be empty') { response.empty? }
33
30
  end
34
31
  end
35
32
  end
36
33
  end
37
-
38
34
  end
@@ -1,10 +1,9 @@
1
1
  Shindo.tests('Fog::Compute[:vsphere] | list_vm_cdroms request', ['vsphere']) do
2
-
3
2
  compute = Fog::Compute[:vsphere]
4
3
 
5
4
  tests('The response should') do
6
5
  response = compute.list_vm_cdroms('5032c8a5-9c5e-ba7a-3804-832a03e16381')
7
- test('be a kind of Array') { response.kind_of? Array }
6
+ test('be a kind of Array') { response.is_a? Array }
8
7
  test('it should contains Hashes') { response.all? { |i| Hash === i } }
9
8
  end
10
9
  end
@@ -1,10 +1,9 @@
1
1
  Shindo.tests('Fog::Compute[:vsphere] | list_vm_snapshots request', ['vsphere']) do
2
-
3
2
  compute = Fog::Compute[:vsphere]
4
3
 
5
4
  tests('The response should') do
6
5
  response = compute.list_vm_snapshots('5032c8a5-9c5e-ba7a-3804-832a03e16381')
7
- test('be a kind of Array') { response.kind_of? Array }
6
+ test('be a kind of Array') { response.is_a? Array }
8
7
  test('it should contains Hashes') { response.all? { |i| Hash === i } }
9
8
  end
10
9
  end
@@ -1,21 +1,20 @@
1
1
  Shindo.tests('Fog::Compute[:vsphere] | modify_vm_cdrom request', ['vsphere']) do
2
-
3
2
  compute = Fog::Compute[:vsphere]
4
3
 
5
4
  modify_target = '5032c8a5-9c5e-ba7a-3804-832a03e16381'
6
5
  modify_cdrom = compute.cdroms.new(
7
- instance_uuid: modify_target,
6
+ instance_uuid: modify_target
8
7
  )
9
8
 
10
9
  tests('When adding a cdrom the response should') do
11
10
  response = compute.add_vm_cdrom(modify_cdrom)
12
- test('be a kind of Hash') { response.kind_of? Hash }
11
+ test('be a kind of Hash') { response.is_a? Hash }
13
12
  test('should have a task_state key') { response.key? 'task_state' }
14
13
  end
15
14
 
16
15
  tests('When destroying a cdrom the response should') do
17
16
  response = compute.destroy_vm_cdrom(modify_cdrom)
18
- test('be a kind of Hash') { response.kind_of? Hash }
17
+ test('be a kind of Hash') { response.is_a? Hash }
19
18
  test('should have a task_state key') { response.key? 'task_state' }
20
19
  end
21
20
  end
@@ -1,15 +1,13 @@
1
1
  Shindo.tests('Fog::Compute[:vsphere] | revert_to_snapshot request', ['vsphere']) do
2
-
3
2
  compute = Fog::Compute[:vsphere]
4
3
 
5
4
  tests('The response should') do
6
- response = compute.revert_to_snapshot(Fog::Compute::Vsphere::Snapshot.new(:service => 1))
7
- test('be a kind of Hash') { response.kind_of? Hash }
5
+ response = compute.revert_to_snapshot(Fog::Compute::Vsphere::Snapshot.new(service: 1))
6
+ test('be a kind of Hash') { response.is_a? Hash }
8
7
  test('should have a task_state key') { response.key? 'state' }
9
8
  end
10
9
 
11
10
  tests('The expected options') do
12
11
  raises(ArgumentError, 'raises ArgumentError when input param is missing') { compute.revert_to_snapshot(nil) }
13
12
  end
14
-
15
13
  end
@@ -1,5 +1,4 @@
1
1
  Shindo.tests('Fog::Compute[:vsphere] | set_vm_customvalue request', ['vsphere']) do
2
-
3
2
  compute = Fog::Compute[:vsphere]
4
3
 
5
4
  instance_uuid = '50137835-88a1-436e-768e-9b2677076e67'
@@ -16,5 +15,4 @@ Shindo.tests('Fog::Compute[:vsphere] | set_vm_customvalue request', ['vsphere'])
16
15
  raises(ArgumentError, 'raises ArgumentError when custom_key option is missing') { compute.set_vm_customvalue(instance_uuid) }
17
16
  raises(ArgumentError, 'raises ArgumentError when custom_value option is missing') { compute.set_vm_customvalue(instance_uuid, custom_key) }
18
17
  end
19
-
20
18
  end
@@ -0,0 +1,13 @@
1
+ require 'ostruct'
2
+
3
+ Shindo.tests('Fog::Compute[:vsphere] | update_vm request', 'vsphere') do
4
+ compute = Fog::Compute[:vsphere]
5
+ server = Fog::Compute::Vsphere::Server.new
6
+
7
+ tests('UPDATE vm | The return value should') do
8
+ response = compute.update_vm(server)
9
+ test('be a kind of Hash') { response.is_a? Hash }
10
+ test('should have a task_state key') { response.key? 'task_state' }
11
+ test('be a kind of Hash') { response.is_a? Hash }
12
+ end
13
+ end
@@ -1,47 +1,47 @@
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
5
5
  response_linked = nil
6
6
 
7
- template = "rhel64"
8
- datacenter = "Solutions"
7
+ template = 'rhel64'
8
+ datacenter = 'Solutions'
9
9
 
10
- tests("Standard Clone | The return value should") do
10
+ tests('Standard Clone | The return value should') do
11
11
  servers_size = compute.servers.size
12
12
  response = compute.vm_clone('datacenter' => datacenter, 'template_path' => template, 'name' => 'cloning_vm', 'wait' => true)
13
- test("be a kind of Hash") { response.kind_of? Hash }
14
- %w{ vm_ref new_vm task_ref }.each do |key|
13
+ test('be a kind of Hash') { response.is_a? Hash }
14
+ %w[vm_ref new_vm task_ref].each do |key|
15
15
  test("have a #{key} key") { response.key? key }
16
16
  end
17
- test("creates a new server") { compute.servers.size == servers_size+1 }
18
- test("new server name is set") { compute.get_virtual_machine(response['new_vm']['id'])['name'] == 'cloning_vm' }
17
+ test('creates a new server') { compute.servers.size == servers_size + 1 }
18
+ test('new server name is set') { compute.get_virtual_machine(response['new_vm']['id'])['name'] == 'cloning_vm' }
19
19
  end
20
20
 
21
- tests("Standard Clone setting ram and cpu | The return value should") do
21
+ tests('Standard Clone setting ram and cpu | The return value should') do
22
22
  servers_size = compute.servers.size
23
23
  response = compute.vm_clone('datacenter' => datacenter, 'template_path' => template, 'name' => 'cloning_vm', 'memoryMB' => '8192', 'numCPUs' => '8', 'wait' => true)
24
- test("be a kind of Hash") { response.kind_of? Hash }
25
- %w{ vm_ref new_vm task_ref }.each do |key|
24
+ test('be a kind of Hash') { response.is_a? Hash }
25
+ %w[vm_ref new_vm task_ref].each do |key|
26
26
  test("have a #{key} key") { response.key? key }
27
27
  end
28
- test("creates a new server") { compute.servers.size == servers_size+1 }
29
- test("new server name is set") { compute.get_virtual_machine(response['new_vm']['id'])['name'] == 'cloning_vm' }
28
+ test('creates a new server') { compute.servers.size == servers_size + 1 }
29
+ test('new server name is set') { compute.get_virtual_machine(response['new_vm']['id'])['name'] == 'cloning_vm' }
30
30
  end
31
31
 
32
- tests("Linked Clone | The return value should") do
32
+ tests('Linked Clone | The return value should') do
33
33
  servers_size = compute.servers.size
34
34
  response = compute.vm_clone('datacenter' => datacenter, 'template_path' => template, 'name' => 'cloning_vm_linked', 'wait' => 1, 'linked_clone' => true)
35
- test("be a kind of Hash") { response.kind_of? Hash }
36
- %w{ vm_ref new_vm task_ref }.each do |key|
35
+ test('be a kind of Hash') { response.is_a? Hash }
36
+ %w[vm_ref new_vm task_ref].each do |key|
37
37
  test("have a #{key} key") { response.key? key }
38
38
  end
39
- test("creates a new server") { compute.servers.size == servers_size+1 }
40
- test("new server name is set") { compute.get_virtual_machine(response['new_vm']['id'])['name'] == 'cloning_vm_linked' }
39
+ test('creates a new server') { compute.servers.size == servers_size + 1 }
40
+ test('new server name is set') { compute.get_virtual_machine(response['new_vm']['id'])['name'] == 'cloning_vm_linked' }
41
41
  end
42
42
 
43
- tests("When invalid input is presented") do
44
- raises(ArgumentError, 'it should raise ArgumentError') { compute.vm_clone(:foo => 1) }
43
+ tests('When invalid input is presented') do
44
+ raises(ArgumentError, 'it should raise ArgumentError') { compute.vm_clone(foo: 1) }
45
45
  raises(Fog::Compute::Vsphere::NotFound, 'it should raise Fog::Compute::Vsphere::NotFound when the UUID is not a string') do
46
46
  pending # require 'guid'
47
47
  compute.vm_clone('instance_uuid' => Guid.from_s(template), 'name' => 'jefftestfoo')