fog 1.35.0 → 1.36.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -0
  3. data/CHANGELOG.md +50 -0
  4. data/fog.gemspec +6 -6
  5. data/lib/fog/digitalocean/models/compute/server.rb +0 -1
  6. data/lib/fog/digitalocean/requests/compute_v2/create_ssh_key.rb +10 -8
  7. data/lib/fog/digitalocean/requests/compute_v2/delete_ssh_key.rb +5 -1
  8. data/lib/fog/digitalocean/requests/compute_v2/list_ssh_keys.rb +6 -1
  9. data/lib/fog/glesys/models/compute/server.rb +0 -1
  10. data/lib/fog/joyent/compute.rb +6 -1
  11. data/lib/fog/linode/compute.rb +3 -0
  12. data/lib/fog/linode/models/compute/data_center.rb +1 -0
  13. data/lib/fog/linode/models/compute/flavor.rb +3 -0
  14. data/lib/fog/linode/models/compute/flavors.rb +8 -1
  15. data/lib/fog/linode/models/compute/image.rb +2 -0
  16. data/lib/fog/linode/models/compute/images.rb +2 -1
  17. data/lib/fog/linode/models/compute/kernel.rb +3 -0
  18. data/lib/fog/linode/models/compute/kernels.rb +14 -8
  19. data/lib/fog/linode/models/compute/node_balancer_flavor.rb +13 -0
  20. data/lib/fog/linode/models/compute/node_balancer_flavors.rb +27 -0
  21. data/lib/fog/linode/requests/compute/avail_kernels.rb +17 -18
  22. data/lib/fog/linode/requests/compute/avail_linodeplans.rb +4 -2
  23. data/lib/fog/linode/requests/compute/avail_nodebalancers.rb +42 -0
  24. data/lib/fog/linode/requests/compute/avail_stackscripts.rb +6 -11
  25. data/lib/fog/openstack/core.rb +22 -21
  26. data/lib/fog/openstack/models/baremetal/nodes.rb +1 -1
  27. data/lib/fog/openstack/models/identity_v3/domain.rb +6 -0
  28. data/lib/fog/openstack/models/identity_v3/domains.rb +19 -4
  29. data/lib/fog/openstack/models/identity_v3/project.rb +10 -0
  30. data/lib/fog/openstack/models/identity_v3/projects.rb +16 -3
  31. data/lib/fog/openstack/models/identity_v3/tokens.rb +1 -0
  32. data/lib/fog/openstack/models/storage/file.rb +9 -0
  33. data/lib/fog/openstack/requests/baremetal/delete_node.rb +1 -1
  34. data/lib/fog/rackspace/requests/load_balancers/create_node.rb +1 -1
  35. data/lib/fog/version.rb +1 -1
  36. data/lib/fog/vsphere/compute.rb +8 -0
  37. data/lib/fog/vsphere/models/compute/network.rb +1 -0
  38. data/lib/fog/vsphere/models/compute/process.rb +18 -0
  39. data/lib/fog/vsphere/models/compute/server.rb +29 -0
  40. data/lib/fog/vsphere/models/compute/snapshot.rb +35 -0
  41. data/lib/fog/vsphere/models/compute/snapshots.rb +27 -0
  42. data/lib/fog/vsphere/requests/compute/create_vm.rb +65 -2
  43. data/lib/fog/vsphere/requests/compute/list_child_snapshots.rb +71 -0
  44. data/lib/fog/vsphere/requests/compute/list_networks.rb +5 -4
  45. data/lib/fog/vsphere/requests/compute/list_processes.rb +41 -0
  46. data/lib/fog/vsphere/requests/compute/list_vm_snapshots.rb +66 -0
  47. data/lib/fog/vsphere/requests/compute/revert_to_snapshot.rb +30 -0
  48. data/lib/fog/vsphere/requests/compute/vm_clone.rb +2 -5
  49. data/lib/fog/vsphere/requests/compute/vm_take_snapshot.rb +37 -0
  50. data/lib/tasks/changelog_task.rb +1 -0
  51. data/spec/fog/openstack/identity_v3/authv3_a.yml +18 -18
  52. data/spec/fog/openstack/identity_v3/authv3_b.yml +18 -18
  53. data/spec/fog/openstack/identity_v3/authv3_c.yml +293 -55
  54. data/spec/fog/openstack/identity_v3/authv3_token.yml +89 -89
  55. data/spec/fog/openstack/identity_v3/authv3_unscoped.yml +325 -222
  56. data/spec/fog/openstack/identity_v3/authv3_unscoped_reauth.yml +587 -111
  57. data/spec/fog/openstack/identity_v3/common_setup.yml +30 -30
  58. data/spec/fog/openstack/identity_v3/idv3_credential.yml +17 -17
  59. data/spec/fog/openstack/identity_v3/idv3_credential_crud.yml +343 -106
  60. data/spec/fog/openstack/identity_v3/idv3_domain.yml +27 -122
  61. data/spec/fog/openstack/identity_v3/idv3_domain_crud.yml +75 -128
  62. data/spec/fog/openstack/identity_v3/idv3_domain_group_roles_mutation.yml +141 -141
  63. data/spec/fog/openstack/identity_v3/idv3_domain_roles_mutation.yml +326 -86
  64. data/spec/fog/openstack/identity_v3/idv3_endpoint.yml +221 -221
  65. data/spec/fog/openstack/identity_v3/idv3_endpoints_crud.yml +314 -314
  66. data/spec/fog/openstack/identity_v3/idv3_group_crud_mutation.yml +191 -188
  67. data/spec/fog/openstack/identity_v3/idv3_policy.yml +23 -23
  68. data/spec/fog/openstack/identity_v3/idv3_policy_crud.yml +67 -67
  69. data/spec/fog/openstack/identity_v3/idv3_project.yml +267 -161
  70. data/spec/fog/openstack/identity_v3/idv3_project_crud.yml +70 -145
  71. data/spec/fog/openstack/identity_v3/idv3_project_group_user_roles_mutation.yml +195 -243
  72. data/spec/fog/openstack/identity_v3/idv3_project_hier_crud_list.yml +203 -553
  73. data/spec/fog/openstack/identity_v3/idv3_role.yml +49 -49
  74. data/spec/fog/openstack/identity_v3/idv3_role_crud.yml +92 -92
  75. data/spec/fog/openstack/identity_v3/idv3_service.yml +61 -61
  76. data/spec/fog/openstack/identity_v3/idv3_services_crud.yml +111 -111
  77. data/spec/fog/openstack/identity_v3/idv3_token.yml +84 -84
  78. data/spec/fog/openstack/identity_v3/idv3_user_crud.yml +140 -125
  79. data/spec/fog/openstack/identity_v3/idv3_users.yml +98 -78
  80. data/spec/fog/openstack/network/common_setup.yml +84 -75
  81. data/spec/fog/openstack/network/subnets_crud.yml +75 -35
  82. data/spec/fog/openstack/shared_context.rb +5 -1
  83. data/tests/helper.rb +1 -0
  84. data/tests/linode/requests/compute/datacenter_tests.rb +2 -1
  85. data/tests/linode/requests/compute/kernel_tests.rb +2 -10
  86. data/tests/linode/requests/compute/linodeplans_tests.rb +10 -7
  87. data/tests/linode/requests/compute/nodebalancers_tests.rb +20 -0
  88. data/tests/openstack/models/storage/file_tests.rb +29 -0
  89. data/tests/rackspace/requests/load_balancers/node_tests.rb +7 -0
  90. data/tests/vsphere/models/compute/server_tests.rb +27 -1
  91. data/tests/vsphere/requests/compute/list_child_snapshots_tests.rb +10 -0
  92. data/tests/vsphere/requests/compute/list_vm_snapshots_tests.rb +10 -0
  93. data/tests/vsphere/requests/compute/revert_to_snapshot_tests.rb +15 -0
  94. data/tests/vsphere/requests/compute/vm_take_snapshot_tests.rb +19 -0
  95. metadata +41 -16
  96. data/spec/fog/openstack/identity_v3/authv3_project.yml +0 -98
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9d70adc0e2d4691ae0c52c21c326ef46cd7bff6
4
- data.tar.gz: 88c2a0583be38c0c470191eb837cf90d7fe02c7f
3
+ metadata.gz: f9cedf56d775bede91d6a668e2f9914ca6c70ba0
4
+ data.tar.gz: 520ffb04055ee86be3f87d1b235e70e362cb1d58
5
5
  SHA512:
6
- metadata.gz: 1657e1baa79242c845c9bed96dcb269de8c9b500bceb408ce31487af02103050bf5d56dd63e178705c0187f3dc83db2cf19a8245b64edbcbc4eba698bd046aa8
7
- data.tar.gz: bbcf356f04b3f119edf2f43c389563f5170f55c4cb9e4a398d58b395cd5ebe3367e609e9f83520f8e1697a9d41954fa1ba1a9d8f98605799264674ef97a8aaca
6
+ metadata.gz: b58ecca0b95feb6a2a25295c3f218fc08b8f4f4cb198d4b6048684300ee74b4270e1ce666449c1974cca1b3fdaf1654a9408976bd21000228d5e061dbb1b8f0b
7
+ data.tar.gz: b0f5b97ad7da4e7926305cd71ca9f13bdfa94ea68f0c82a9cb65a8ffa882585320ee747d3544d18f089de4319f990170c5e10eca9820ba5bc4b0c16e7ad7eba2
@@ -5,10 +5,12 @@ sudo: false
5
5
  script: bundle exec rake travis
6
6
 
7
7
  rvm:
8
+ - 1.9
8
9
  - 2.0
9
10
  - 2.1
10
11
  - 2.2
11
12
  - jruby-head
13
+ - jruby-19mode
12
14
 
13
15
  gemfile:
14
16
  - Gemfile
@@ -1,3 +1,53 @@
1
+ ## 1.36.0 11/16/2015
2
+ *Hash* e7cd19696284633d4363993e2e3fda41384b7d58
3
+
4
+ Statistic | Value
5
+ ------------- | --------:
6
+ Collaborators | 2
7
+ Downloads | 12793379
8
+ Forks | 1517
9
+ Open Issues | 92
10
+ Watchers | 3689
11
+
12
+ **MVP!** Phil Ross
13
+
14
+ #### [misc]
15
+ * added content-encoding meta-data. thanks ller
16
+ * version for fog-aliyun added in fog.gemspec. thanks Daniyal Shah
17
+ * Digital Ocean V2 call to create an ssh key returns a 201 on success: https://developers.digitalocean.com/documentation/v2/#create-a-new-key. thanks Dave Benvenuti
18
+ * improve mocks to more closely match real ssh key endpoint functionality. thanks Dave Benvenuti
19
+ * Fix issue when creating virtual machines with more than 7 disks. thanks Francois Herbert
20
+ * Fix distributed port group switches support for cloning with multiple networks. thanks as
21
+ * Extract virtualswitch parameter to the network model. thanks as
22
+ * fix openstack baremetal node delete. thanks Jason Montleon
23
+ * Fixed issue with OpenStack Auth v2. thanks ller
24
+ * Fix set node type for Rackspace load balancer. thanks Pablo Porto
25
+ * Add abbr attribute to Linode DataCenter. thanks Phil Ross
26
+ * Add created_at and requires_pvops_kernel to Linode Image model. thanks Phil Ross
27
+ * Update the Linode avail_kernels request and Kernel model. thanks Phil Ross
28
+ * Update the Linode avail_linodeplans request and Flavor model. thanks Phil Ross
29
+ * Add support for the Linode avail.nodebalancers API call. thanks Phil Ross
30
+ * Fix the signature of the Linode avail_stackscripts mock. thanks Phil Ross
31
+ * Use options on the all method to filter Linode kernels. thanks Phil Ross
32
+ * fix method call name in openstack node destroy so that it will work. thanks Stephen Herr
33
+ * vsphere: allow setting of boot order when using api > 5.0. thanks Timo Goebel
34
+ * Revert "temporarily relax ruby version constraint". thanks geemus
35
+ * make net/ssh require optional. thanks geemus
36
+ * re-add 1.9 to travis config. thanks geemus
37
+ * limit to 1.9 compat fog-google. thanks geemus
38
+ * 1.8 compatibility for pre 2 release. thanks geemus
39
+
40
+ #### [openstack]
41
+ * Basic caching support for auth tokens, domains & projects. thanks Darren Hague
42
+ * Re-record VCRs, plus some light refactoring. thanks Darren Hague
43
+
44
+ #### [vsphere]
45
+ * add support for taking snapshot. thanks Ivo Reznicek
46
+ * support for snapshot list and revert. thanks Ivo Reznicek
47
+ * support for listing processes in guest OS. thanks Ivo Reznicek
48
+ * Prefer Class#name to Class#to_s. thanks Kevin Menard
49
+
50
+
1
51
  ## 1.35.0 10/20/2015
2
52
  *Hash* 4444f3287454a4281ead73fa24aa1b93d5d23a39
3
53
 
@@ -11,8 +11,8 @@ Gem::Specification.new do |s|
11
11
  ## If your rubyforge_project name is different, then edit it and comment out
12
12
  ## the sub! line in the Rakefile
13
13
  s.name = "fog"
14
- s.version = "1.35.0"
15
- s.date = "2015-10-20"
14
+ s.version = "1.36.0"
15
+ s.date = "2015-11-16"
16
16
  s.rubyforge_project = "fog"
17
17
 
18
18
  ## Make sure your summary is short. The description may be as long
@@ -49,7 +49,7 @@ Gem::Specification.new do |s|
49
49
  s.add_dependency("fog-xml", "~> 0.1.1")
50
50
 
51
51
  s.add_dependency("ipaddress", "~> 0.5")
52
- s.add_dependency("nokogiri")
52
+ s.add_dependency("nokogiri", "~> 1.5", ">= 1.5.11")
53
53
 
54
54
  # Modular providers (please keep sorted)
55
55
  s.add_dependency("fog-atmos")
@@ -57,7 +57,7 @@ Gem::Specification.new do |s|
57
57
  s.add_dependency("fog-brightbox", "~> 0.4")
58
58
  s.add_dependency("fog-dynect", "~> 0.0.2")
59
59
  s.add_dependency("fog-ecloud", "~> 0.1")
60
- s.add_dependency("fog-google", ">= 0.1.1")
60
+ s.add_dependency("fog-google", "<= 0.1.0")
61
61
  s.add_dependency("fog-local")
62
62
  s.add_dependency("fog-powerdns", ">= 0.1.1")
63
63
  s.add_dependency("fog-profitbricks")
@@ -71,7 +71,7 @@ Gem::Specification.new do |s|
71
71
  s.add_dependency("fog-vmfusion")
72
72
  s.add_dependency("fog-voxel")
73
73
  s.add_dependency("fog-xenserver")
74
- s.add_dependency("fog-aliyun")
74
+ s.add_dependency("fog-aliyun",">= 0.1.0")
75
75
 
76
76
  s.add_development_dependency("docker-api", ">= 1.13.6")
77
77
  s.add_development_dependency("fission")
@@ -90,7 +90,7 @@ Gem::Specification.new do |s|
90
90
  s.add_development_dependency("rspec-core")
91
91
  s.add_development_dependency("rspec-expectations")
92
92
  s.add_development_dependency("vcr")
93
- s.add_development_dependency("webmock")
93
+ s.add_development_dependency("webmock","~>1.22.2")
94
94
 
95
95
  s.files = `git ls-files`.split("\n")
96
96
  s.test_files = `git ls-files -- {spec,tests}/*`.split("\n")
@@ -81,7 +81,6 @@ module Fog
81
81
 
82
82
  def setup(credentials = {})
83
83
  requires :ssh_ip_address
84
- require 'net/ssh'
85
84
 
86
85
  commands = [
87
86
  %{mkdir .ssh},
@@ -13,7 +13,7 @@ module Fog
13
13
  encoded_body = Fog::JSON.encode(create_options)
14
14
 
15
15
  request(
16
- :expects => [202],
16
+ :expects => [201],
17
17
  :headers => {
18
18
  'Content-Type' => "application/json; charset=UTF-8",
19
19
  },
@@ -28,15 +28,17 @@ module Fog
28
28
  class Mock
29
29
  def create_ssh_key(name, public_key)
30
30
  response = Excon::Response.new
31
- response.status = 202
31
+ response.status = 201
32
+
33
+ data[:ssh_keys] << {
34
+ "id" => Fog::Mock.random_numbers(6).to_i,
35
+ "fingerprint" => (["00"] * 16).join(':'),
36
+ "public_key" => public_key,
37
+ "name" => name
38
+ }
32
39
 
33
40
  response.body ={
34
- 'ssh_key' => {
35
- 'id' => 512190,
36
- 'fingerprint' => "3b:16:bf:e4:8b:00:8b:b8:59:8c:a9:d3:f0:19:45:fa",
37
- 'public_key' => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAQQDDHr/jh2Jy4yALcK4JyWbVkPRaWmhck3IgCoeOO3z1e2dBowLh64QAM+Qb72pxekALga2oi4GvT+TlWNhzPH4V example",
38
- 'name' => "My SSH Public Key"
39
- }
41
+ 'ssh_key' => data[:ssh_keys].last
40
42
  }
41
43
 
42
44
  response
@@ -17,7 +17,11 @@ module Fog
17
17
 
18
18
  # noinspection RubyStringKeysInHashInspection
19
19
  class Mock
20
- def delete_ssh_key(_)
20
+ def delete_ssh_key(id)
21
+ self.data[:ssh_keys].select! do |key|
22
+ key["id"] != id
23
+ end
24
+
21
25
  response = Excon::Response.new
22
26
  response.status = 204
23
27
  response
@@ -17,10 +17,15 @@ module Fog
17
17
  response = Excon::Response.new
18
18
  response.status = 200
19
19
  response.body = {
20
+ "ssh_keys" => data[:ssh_keys],
21
+ "links" => {},
22
+ "meta" => {
23
+ "total" => data[:ssh_keys].count
24
+ }
20
25
  }
21
26
  response
22
27
  end
23
28
  end
24
29
  end
25
30
  end
26
- end
31
+ end
@@ -90,7 +90,6 @@ module Fog
90
90
 
91
91
  def setup(credentials = {})
92
92
  requires :ssh_ip_address, :username
93
- require 'net/ssh'
94
93
 
95
94
  attrs = attributes.dup
96
95
  attrs.delete(:rootpassword)
@@ -1,6 +1,5 @@
1
1
  require 'fog/joyent/core'
2
2
  require 'fog/joyent/errors'
3
- require 'net/ssh'
4
3
 
5
4
  module Fog
6
5
  module Compute
@@ -126,6 +125,12 @@ module Fog
126
125
  end
127
126
 
128
127
  if options[:joyent_keyname]
128
+ begin
129
+ require "net/ssh"
130
+ rescue LoadError
131
+ Fog::Logger.warning("'net/ssh' missing, please install and try again.")
132
+ exit(1)
133
+ end
129
134
  @joyent_keyname = options[:joyent_keyname]
130
135
  @joyent_keyphrase = options[:joyent_keyphrase]
131
136
  @key_manager = Net::SSH::Authentication::KeyManager.new(nil, {
@@ -23,12 +23,15 @@ module Fog
23
23
  collection :ips
24
24
  model :disk
25
25
  collection :disks
26
+ model :node_balancer_flavor
27
+ collection :node_balancer_flavors
26
28
 
27
29
  request_path 'fog/linode/requests/compute'
28
30
  request :avail_datacenters
29
31
  request :avail_distributions
30
32
  request :avail_kernels
31
33
  request :avail_linodeplans
34
+ request :avail_nodebalancers
32
35
  request :avail_stackscripts
33
36
  request :linode_disk_create
34
37
  request :linode_disk_list
@@ -6,6 +6,7 @@ module Fog
6
6
  class DataCenter < Fog::Model
7
7
  identity :id
8
8
  attribute :location
9
+ attribute :abbr
9
10
  end
10
11
  end
11
12
  end
@@ -8,8 +8,11 @@ module Fog
8
8
  attribute :disk
9
9
  attribute :name
10
10
  attribute :ram
11
+ attribute :transfer
11
12
  attribute :price
13
+ attribute :price_hourly
12
14
  attribute :cores
15
+ attribute :available
13
16
 
14
17
  def bits
15
18
  0 # these are determined by images you select not the hardware
@@ -24,7 +24,14 @@ module Fog
24
24
 
25
25
  def map_flavor(flavor)
26
26
  flavor = flavor.each_with_object({}) { |(k, v), h| h[k.downcase.to_sym] = v }
27
- flavor.merge! :id => flavor[:planid], :name => flavor[:label]
27
+ flavor.merge! :id => flavor[:planid], :name => flavor[:label],
28
+ :transfer => flavor[:xfer], :price_hourly => flavor[:hourly],
29
+ :available => map_available(flavor[:avail])
30
+ end
31
+
32
+ def map_available(available)
33
+ return nil unless available
34
+ available.each_with_object({}) { |(k, v), h| h[k.to_i] = v }
28
35
  end
29
36
  end
30
37
  end
@@ -8,6 +8,8 @@ module Fog
8
8
  attribute :name
9
9
  attribute :bits
10
10
  attribute :image_size
11
+ attribute :created_at, types: 'time'
12
+ attribute :requires_pvops_kernel
11
13
  end
12
14
  end
13
15
  end
@@ -25,7 +25,8 @@ module Fog
25
25
  def map_image(image)
26
26
  image = image.each_with_object({}) { |(k, v), h| h[k.downcase.to_sym] = v }
27
27
  image.merge!(:id => image[:distributionid], :name => image[:label], :image_size => image[:minimagesize],
28
- :kernel_id => image[:requirespvopskernel], :bits => ((image[:is64bit] == 1) ? 64 : 32 ))
28
+ :requires_pvops_kernel => image[:requirespvopskernel], :bits => ((image[:is64bit] == 1) ? 64 : 32 ),
29
+ :created_at => image[:create_dt])
29
30
  end
30
31
  end
31
32
  end
@@ -6,6 +6,9 @@ module Fog
6
6
  class Kernel < Fog::Model
7
7
  identity :id
8
8
  attribute :name
9
+ attribute :is_xen
10
+ attribute :is_kvm
11
+ attribute :is_pvops
9
12
  end
10
13
  end
11
14
  end
@@ -7,24 +7,30 @@ module Fog
7
7
  class Kernels < Fog::Collection
8
8
  model Fog::Compute::Linode::Kernel
9
9
 
10
- def all
11
- load kernels
10
+ # Returns an Array of the available kernels.
11
+ #
12
+ # The list of kernels can be filtered by support for KVM or Xen by
13
+ # specifying kvm: true or xen: true respectively as options.
14
+ def all(options={})
15
+ [[:kvm, :isKVM], [:xen, :isXen]].each do |type, param|
16
+ options[param] = options[type] ? 1 : 0 if options.has_key?(type)
17
+ end
18
+ load kernels(options)
12
19
  end
13
20
 
14
21
  def get(id)
15
- new kernels(id).select {|kernel| kernel[:id] == id }.first
16
- rescue Fog::Compute::Linode::NotFound
17
- nil
22
+ new kernels.select {|kernel| kernel[:id] == id }.first
18
23
  end
19
24
 
20
25
  private
21
- def kernels(id=nil)
22
- service.avail_kernels(id).body['DATA'].map { |kernel| map_kernel kernel }
26
+ def kernels(options={})
27
+ service.avail_kernels(options).body['DATA'].map { |kernel| map_kernel kernel }
23
28
  end
24
29
 
25
30
  def map_kernel(kernel)
26
31
  kernel = kernel.each_with_object({}) { |(k, v), h| h[k.downcase.to_sym] = v }
27
- kernel.merge! :id => kernel[:kernelid], :name => kernel[:label]
32
+ kernel.merge! :id => kernel[:kernelid], :name => kernel[:label],
33
+ :is_xen => kernel[:isxen], :is_kvm => kernel[:iskvm], :is_pvops => kernel[:ispvops]
28
34
  end
29
35
  end
30
36
  end
@@ -0,0 +1,13 @@
1
+ require 'fog/core/model'
2
+
3
+ module Fog
4
+ module Compute
5
+ class Linode
6
+ class NodeBalancerFlavor < Fog::Model
7
+ attribute :price_monthly
8
+ attribute :price_hourly
9
+ attribute :connections
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,27 @@
1
+ require 'fog/core/collection'
2
+ require 'fog/linode/models/compute/node_balancer_flavor'
3
+
4
+ module Fog
5
+ module Compute
6
+ class Linode
7
+ class NodeBalancerFlavors < Fog::Collection
8
+ model Fog::Compute::Linode::NodeBalancerFlavor
9
+
10
+ def all
11
+ load node_balancer_flavors
12
+ end
13
+
14
+ private
15
+ def node_balancer_flavors
16
+ service.avail_nodebalancers.body['DATA'].map { |node_balancer_flavor| map_node_balancer_flavor node_balancer_flavor }
17
+ end
18
+
19
+ def map_node_balancer_flavor(node_balancer_flavor)
20
+ node_balancer_flavor = node_balancer_flavor.each_with_object({}) { |(k, v), h| h[k.downcase.to_sym] = v }
21
+ node_balancer_flavor.merge! :price_monthly => node_balancer_flavor[:monthly],
22
+ :price_hourly => node_balancer_flavor[:hourly]
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -5,27 +5,30 @@ module Fog
5
5
  # Get available kernels
6
6
  #
7
7
  # ==== Parameters
8
- # * kernelId<~Integer>: id to limit results to
8
+ # * options<~Hash>
9
+ # * isXen<~Boolean> Show or hide Xen compatible kernels
10
+ # * isKVM<~Boolean> Show or hide KVM compatible kernels
9
11
  #
10
12
  # ==== Returns
11
13
  # * response<~Excon::Response>:
12
14
  # * body<~Array>:
13
15
  # TODO: docs
14
- def avail_kernels(kernel_id=nil)
15
- options = {}
16
- if kernel_id
17
- options.merge!(:kernelId => kernel_id)
18
- end
16
+ def avail_kernels(options={})
17
+ # avail.kernels used to accept a kernelId parameter (now removed)
18
+ raise Fog::Errors::Error.new('avail_kernels no longer accepts a kernelId parameter') unless !options || options.is_a?(Hash)
19
19
  request(
20
20
  :expects => 200,
21
21
  :method => 'GET',
22
- :query => { :api_action => 'avail.kernels' }.merge!(options)
22
+ :query => { :api_action => 'avail.kernels' }.merge!(options || {})
23
23
  )
24
24
  end
25
25
  end
26
26
 
27
27
  class Mock
28
- def avail_kernels(kernel_id=nil)
28
+ def avail_kernels(options={})
29
+ # avail.kernels used to accept a kernelId parameter (now removed)
30
+ raise Fog::Errors::Error.new('avail_kernels no longer accepts a kernelId parameter') unless !options || options.is_a?(Hash)
31
+
29
32
  response = Excon::Response.new
30
33
  response.status = 200
31
34
 
@@ -33,17 +36,12 @@ module Fog
33
36
  "ERRORARRAY" => [],
34
37
  "ACTION" => "avail.kernels"
35
38
  }
36
- if kernel_id
37
- mock_kernel = create_mock_kernel(kernel_id)
38
- response.body = body.merge("DATA" => [mock_kernel])
39
- else
40
- mock_kernels = []
41
- 10.times do
42
- kernel_id = rand(1..200)
43
- mock_kernels << create_mock_kernel(kernel_id)
44
- end
45
- response.body = body.merge("DATA" => mock_kernels)
39
+ mock_kernels = []
40
+ 10.times do
41
+ kernel_id = rand(1..200)
42
+ mock_kernels << create_mock_kernel(kernel_id)
46
43
  end
44
+ response.body = body.merge("DATA" => mock_kernels)
47
45
  response
48
46
  end
49
47
 
@@ -53,6 +51,7 @@ module Fog
53
51
  {
54
52
  "ISPVOPS" => 1,
55
53
  "ISXEN" => 1,
54
+ "ISKVM" => 1,
56
55
  "KERNELID" => kernel_id,
57
56
  "LABEL" => "Latest 3.0 (3.0.18-linode43)"
58
57
  }