fog-openstack 0.1.21 → 0.1.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fog/compute/openstack/requests/add_flavor_access.rb +1 -1
  3. data/lib/fog/compute/openstack/requests/allocate_address.rb +1 -1
  4. data/lib/fog/compute/openstack/requests/boot_from_snapshot.rb +1 -1
  5. data/lib/fog/compute/openstack/requests/create_key_pair.rb +1 -1
  6. data/lib/fog/compute/openstack/requests/create_security_group.rb +1 -1
  7. data/lib/fog/compute/openstack/requests/create_security_group_rule.rb +1 -1
  8. data/lib/fog/compute/openstack/requests/create_server.rb +5 -7
  9. data/lib/fog/compute/openstack/requests/delete_server.rb +5 -2
  10. data/lib/fog/compute/openstack/requests/get_flavor_details.rb +1 -1
  11. data/lib/fog/compute/openstack/requests/get_host_details.rb +1 -1
  12. data/lib/fog/compute/openstack/requests/get_image_details.rb +1 -1
  13. data/lib/fog/compute/openstack/requests/get_server_details.rb +1 -1
  14. data/lib/fog/compute/openstack/requests/get_server_password.rb +1 -1
  15. data/lib/fog/compute/openstack/requests/list_addresses.rb +1 -1
  16. data/lib/fog/compute/openstack/requests/list_all_addresses.rb +1 -1
  17. data/lib/fog/compute/openstack/requests/list_flavors.rb +1 -1
  18. data/lib/fog/compute/openstack/requests/list_flavors_detail.rb +1 -1
  19. data/lib/fog/compute/openstack/requests/list_hosts.rb +1 -1
  20. data/lib/fog/compute/openstack/requests/list_images.rb +1 -1
  21. data/lib/fog/compute/openstack/requests/list_images_detail.rb +1 -1
  22. data/lib/fog/compute/openstack/requests/list_key_pairs.rb +1 -1
  23. data/lib/fog/compute/openstack/requests/list_metadata.rb +1 -1
  24. data/lib/fog/compute/openstack/requests/list_private_addresses.rb +1 -1
  25. data/lib/fog/compute/openstack/requests/list_public_addresses.rb +1 -1
  26. data/lib/fog/compute/openstack/requests/list_security_groups.rb +1 -1
  27. data/lib/fog/compute/openstack/requests/list_servers.rb +1 -1
  28. data/lib/fog/compute/openstack/requests/list_servers_detail.rb +1 -1
  29. data/lib/fog/compute/openstack/requests/list_tenants_with_flavor_access.rb +1 -1
  30. data/lib/fog/compute/openstack/requests/list_zones.rb +1 -1
  31. data/lib/fog/compute/openstack/requests/list_zones_detailed.rb +1 -1
  32. data/lib/fog/compute/openstack/requests/remove_flavor_access.rb +1 -1
  33. data/lib/fog/compute/openstack/requests/server_action.rb +1 -1
  34. data/lib/fog/compute/openstack/requests/update_metadata.rb +1 -1
  35. data/lib/fog/compute/openstack/requests/update_server.rb +1 -1
  36. data/lib/fog/dns/openstack/v2/requests/create_zone_transfer_accept.rb +4 -1
  37. data/lib/fog/image/openstack/v1/models/images.rb +19 -4
  38. data/lib/fog/image/openstack/v1/requests/get_image_by_id.rb +2 -1
  39. data/lib/fog/metering/openstack/requests/get_samples.rb +2 -1
  40. data/lib/fog/openstack/version.rb +1 -1
  41. data/lib/fog/shared_file_system/openstack.rb +14 -1
  42. data/lib/fog/shared_file_system/openstack/models/availability_zone.rb +15 -0
  43. data/lib/fog/shared_file_system/openstack/models/availability_zones.rb +16 -0
  44. data/lib/fog/shared_file_system/openstack/requests/list_availability_zones.rb +24 -0
  45. data/lib/fog/storage/openstack.rb +1 -0
  46. data/lib/fog/storage/openstack/models/file.rb +16 -4
  47. data/lib/fog/storage/openstack/requests/get_object_https_url.rb +1 -1
  48. data/lib/fog/storage/openstack/requests/post_object.rb +26 -0
  49. data/lib/fog/volume/openstack/requests/snapshot_action.rb +16 -0
  50. data/lib/fog/volume/openstack/v2.rb +1 -0
  51. data/lib/fog/volume/openstack/v2/requests/snapshot_action.rb +2 -0
  52. data/supported.md +22 -20
  53. metadata +43 -38
  54. data/.envrc_empty +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3735199d42be3dc72bc5c40e6de63e9c89cb6960
4
- data.tar.gz: 1ce08c5e313b9bf9425743a3c05b999e999be03b
3
+ metadata.gz: 4390c3d7b0437021392d05e1ca9caeed69dbe040
4
+ data.tar.gz: 67acad217dadd323bb3325f3c7bff3b69738e1e5
5
5
  SHA512:
6
- metadata.gz: 0ecd430174ea0955ccd201adb58e32358c0c7b27658482f81436349fac8bb472d63666df5d730c129a2f4ef69154951b259d55021e580b9e81f880752cc0e6d5
7
- data.tar.gz: 7c3da3efae0ecd4dfb1e38629b6d4e5b13c457a3a105c154448ea47cd79179456a30457c40c461f576ab642dc34a833fc03fe4a1bf632d8b5fa81ead445eeec4
6
+ metadata.gz: 5590632eb25483cdd94d9e18f1f0a5f611dd9136f12ef506a0226a0a1ed51e76eb844e8673069cc8614e11cb46749827826261fb125209c9de5fd142a5efd91c
7
+ data.tar.gz: a7d3cfed1e7470a50d61a69a636ef7c198532b5dab31d701248ad80210bfd46f8f5acc90cd828618d5f02492b26ae23fb5ac47071a2c1721ad78760f43ca9c0f
@@ -9,7 +9,7 @@ module Fog
9
9
  }),
10
10
  :expects => [200, 203],
11
11
  :method => 'POST',
12
- :path => "flavors/#{flavor_ref}/action.json"
12
+ :path => "flavors/#{flavor_ref}/action"
13
13
  )
14
14
  end
15
15
  end
@@ -7,7 +7,7 @@ module Fog
7
7
  :body => Fog::JSON.encode('pool' => pool),
8
8
  :expects => [200, 202],
9
9
  :method => 'POST',
10
- :path => 'os-floating-ips.json'
10
+ :path => 'os-floating-ips'
11
11
  )
12
12
  end
13
13
  end
@@ -32,7 +32,7 @@ module Fog
32
32
  :body => Fog::JSON.encode(data),
33
33
  :expects => [200, 202],
34
34
  :method => 'POST',
35
- :path => '/os-volumes_boot.json'
35
+ :path => '/os-volumes_boot'
36
36
  )
37
37
  end
38
38
  end
@@ -15,7 +15,7 @@ module Fog
15
15
  :body => Fog::JSON.encode(data),
16
16
  :expects => 200,
17
17
  :method => 'POST',
18
- :path => 'os-keypairs.json'
18
+ :path => 'os-keypairs'
19
19
  )
20
20
  end
21
21
  end
@@ -14,7 +14,7 @@ module Fog
14
14
  :body => Fog::JSON.encode(data),
15
15
  :expects => 200,
16
16
  :method => 'POST',
17
- :path => 'os-security-groups.json'
17
+ :path => 'os-security-groups'
18
18
  )
19
19
  end
20
20
  end
@@ -18,7 +18,7 @@ module Fog
18
18
  :expects => 200,
19
19
  :method => 'POST',
20
20
  :body => Fog::JSON.encode(data),
21
- :path => 'os-security-group-rules.json'
21
+ :path => 'os-security-group-rules'
22
22
  )
23
23
  end
24
24
  end
@@ -45,7 +45,8 @@ module Fog
45
45
  if options['nics']
46
46
  data['server']['networks'] =
47
47
  Array(options['nics']).map do |nic|
48
- neti = {'uuid' => (nic['net_id'] || nic[:net_id])}
48
+ neti = {}
49
+ neti['uuid'] = (nic['net_id'] || nic[:net_id]) unless (nic['net_id'] || nic[:net_id]).nil?
49
50
  neti['fixed_ip'] = (nic['v4_fixed_ip'] || nic[:v4_fixed_ip]) unless (nic['v4_fixed_ip'] || nic[:v4_fixed_ip]).nil?
50
51
  neti['port'] = (nic['port_id'] || nic[:port_id]) unless (nic['port_id'] || nic[:port_id]).nil?
51
52
  neti
@@ -59,8 +60,8 @@ module Fog
59
60
  if (block_device_mapping = options['block_device_mapping_v2'])
60
61
  data['server']['block_device_mapping_v2'] = [block_device_mapping].flatten.collect do |mapping|
61
62
  entered_block_device_mapping = {}
62
- [:boot_index, :delete_on_termination, :destination_type, :device_name, :source_type, :uuid,
63
- :volume_size].each do |index|
63
+ [:boot_index, :delete_on_termination, :destination_type, :device_name, :device_type, :disk_bus,
64
+ :guest_format, :source_type, :uuid, :volume_size].each do |index|
64
65
  entered_block_device_mapping[index.to_s] = mapping[index] if mapping.key?(index)
65
66
  end
66
67
  entered_block_device_mapping
@@ -76,7 +77,7 @@ module Fog
76
77
  end
77
78
  end
78
79
 
79
- path = options['block_device_mapping'] ? 'os-volumes_boot.json' : 'servers.json'
80
+ path = options['block_device_mapping'] ? 'os-volumes_boot' : 'servers'
80
81
 
81
82
  request(
82
83
  :body => Fog::JSON.encode(data),
@@ -168,9 +169,6 @@ module Fog
168
169
  response_data['security_groups'] = groups
169
170
  end
170
171
 
171
- data[:last_modified][:servers][server_id] = Time.now
172
- data[:servers][server_id] = mock_data
173
-
174
172
  if options['os:scheduler_hints'] && options['os:scheduler_hints']['group']
175
173
  group = data[:server_groups][options['os:scheduler_hints']['group']]
176
174
  group[:members] << server_id if group
@@ -23,8 +23,11 @@ module Fog
23
23
  data[:last_modified][:servers].delete(server_id)
24
24
  data[:servers].delete(server_id)
25
25
  response.status = 204
26
- group_id, = data[:server_groups].find { |_id, grp| grp[:members].include?(server_id) }
27
- data[:server_groups][group_id][:members] -= [server_id] if group_id
26
+ server_groups = data[:server_groups]
27
+ if server_groups
28
+ group_id, = server_groups.find { |_id, grp| grp[:members].include?(server_id) }
29
+ server_groups[group_id][:members] -= [server_id] if group_id
30
+ end
28
31
  end
29
32
  response
30
33
  else
@@ -6,7 +6,7 @@ module Fog
6
6
  request(
7
7
  :expects => [200, 203],
8
8
  :method => 'GET',
9
- :path => "flavors/#{flavor_ref}.json"
9
+ :path => "flavors/#{flavor_ref}"
10
10
  )
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module Fog
6
6
  request(
7
7
  :expects => [200, 203],
8
8
  :method => 'GET',
9
- :path => "os-hosts/#{host}.json"
9
+ :path => "os-hosts/#{host}"
10
10
  )
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module Fog
6
6
  request(
7
7
  :expects => [200, 203],
8
8
  :method => 'GET',
9
- :path => "images/#{image_id}.json"
9
+ :path => "images/#{image_id}"
10
10
  )
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module Fog
6
6
  request(
7
7
  :expects => [200, 203],
8
8
  :method => 'GET',
9
- :path => "servers/#{server_id}.json"
9
+ :path => "servers/#{server_id}"
10
10
  )
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module Fog
6
6
  request(
7
7
  :expects => [200, 203],
8
8
  :method => 'GET',
9
- :path => "servers/#{server_id}/os-server-password.json"
9
+ :path => "servers/#{server_id}/os-server-password"
10
10
  )
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module Fog
6
6
  request(
7
7
  :expects => [200, 203],
8
8
  :method => 'GET',
9
- :path => "servers/#{server_id}/ips.json"
9
+ :path => "servers/#{server_id}/ips"
10
10
  )
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module Fog
6
6
  request(
7
7
  :expects => [200, 203],
8
8
  :method => 'GET',
9
- :path => "os-floating-ips.json",
9
+ :path => "os-floating-ips",
10
10
  :query => options
11
11
  )
12
12
  end
@@ -6,7 +6,7 @@ module Fog
6
6
  request(
7
7
  :expects => [200, 203],
8
8
  :method => 'GET',
9
- :path => 'flavors.json',
9
+ :path => 'flavors',
10
10
  :query => options
11
11
  )
12
12
  end
@@ -6,7 +6,7 @@ module Fog
6
6
  request(
7
7
  :expects => [200, 203],
8
8
  :method => 'GET',
9
- :path => 'flavors/detail.json',
9
+ :path => 'flavors/detail',
10
10
  :query => options
11
11
  )
12
12
  end
@@ -6,7 +6,7 @@ module Fog
6
6
  request(
7
7
  :expects => [200, 203],
8
8
  :method => 'GET',
9
- :path => 'os-hosts.json',
9
+ :path => 'os-hosts',
10
10
  :query => options
11
11
  )
12
12
  end
@@ -6,7 +6,7 @@ module Fog
6
6
  request(
7
7
  :expects => [200, 203],
8
8
  :method => 'GET',
9
- :path => 'images.json'
9
+ :path => 'images'
10
10
  )
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module Fog
6
6
  request(
7
7
  :expects => [200, 203],
8
8
  :method => 'GET',
9
- :path => 'images/detail.json',
9
+ :path => 'images/detail',
10
10
  :query => filters
11
11
  )
12
12
  end
@@ -6,7 +6,7 @@ module Fog
6
6
  request(
7
7
  :expects => [200, 203],
8
8
  :method => 'GET',
9
- :path => 'os-keypairs.json',
9
+ :path => 'os-keypairs',
10
10
  :query => options
11
11
  )
12
12
  end
@@ -6,7 +6,7 @@ module Fog
6
6
  request(
7
7
  :expects => [200, 203],
8
8
  :method => 'GET',
9
- :path => "/#{collection_name}/#{parent_id}/metadata.json"
9
+ :path => "/#{collection_name}/#{parent_id}/metadata"
10
10
  )
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module Fog
6
6
  request(
7
7
  :expects => [200, 203],
8
8
  :method => 'GET',
9
- :path => "servers/#{server_id}/ips/private.json"
9
+ :path => "servers/#{server_id}/ips/private"
10
10
  )
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module Fog
6
6
  request(
7
7
  :expects => [200, 203],
8
8
  :method => 'GET',
9
- :path => "servers/#{server_id}/ips/public.json"
9
+ :path => "servers/#{server_id}/ips/public"
10
10
  )
11
11
  end
12
12
  end
@@ -3,7 +3,7 @@ module Fog
3
3
  class OpenStack
4
4
  class Real
5
5
  def list_security_groups(options = {})
6
- path = "os-security-groups.json"
6
+ path = "os-security-groups"
7
7
 
8
8
  if options.kind_of?(Hash)
9
9
  server_id = options.delete(:server_id)
@@ -12,7 +12,7 @@ module Fog
12
12
  request(
13
13
  :expects => [200, 203],
14
14
  :method => 'GET',
15
- :path => 'servers.json',
15
+ :path => 'servers',
16
16
  :query => params
17
17
  )
18
18
  end
@@ -13,7 +13,7 @@ module Fog
13
13
  request(
14
14
  :expects => [200, 203],
15
15
  :method => 'GET',
16
- :path => 'servers/detail.json',
16
+ :path => 'servers/detail',
17
17
  :query => params
18
18
  )
19
19
  end
@@ -6,7 +6,7 @@ module Fog
6
6
  request(
7
7
  :expects => [200, 203],
8
8
  :method => 'GET',
9
- :path => "flavors/#{flavor_ref}/os-flavor-access.json"
9
+ :path => "flavors/#{flavor_ref}/os-flavor-access"
10
10
  )
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module Fog
6
6
  request(
7
7
  :expects => 200,
8
8
  :method => 'GET',
9
- :path => 'os-availability-zone.json',
9
+ :path => 'os-availability-zone',
10
10
  :query => options
11
11
  )
12
12
  end
@@ -6,7 +6,7 @@ module Fog
6
6
  request(
7
7
  :expects => 200,
8
8
  :method => 'GET',
9
- :path => 'os-availability-zone/detail.json',
9
+ :path => 'os-availability-zone/detail',
10
10
  :query => options
11
11
  )
12
12
  end
@@ -9,7 +9,7 @@ module Fog
9
9
  }),
10
10
  :expects => [200, 203],
11
11
  :method => 'POST',
12
- :path => "flavors/#{flavor_ref}/action.json"
12
+ :path => "flavors/#{flavor_ref}/action"
13
13
  )
14
14
  end
15
15
  end
@@ -7,7 +7,7 @@ module Fog
7
7
  :body => Fog::JSON.encode(body),
8
8
  :expects => expects,
9
9
  :method => 'POST',
10
- :path => "servers/#{server_id}/action.json"
10
+ :path => "servers/#{server_id}/action"
11
11
  )
12
12
  end
13
13
  end
@@ -7,7 +7,7 @@ module Fog
7
7
  :body => Fog::JSON.encode('metadata' => metadata),
8
8
  :expects => 200,
9
9
  :method => 'POST',
10
- :path => "#{collection_name}/#{parent_id}/metadata.json"
10
+ :path => "#{collection_name}/#{parent_id}/metadata"
11
11
  )
12
12
  end
13
13
  end
@@ -7,7 +7,7 @@ module Fog
7
7
  :body => Fog::JSON.encode('server' => options),
8
8
  :expects => 200,
9
9
  :method => 'PUT',
10
- :path => "servers/#{server_id}.json"
10
+ :path => "servers/#{server_id}"
11
11
  )
12
12
  end
13
13
  end
@@ -3,13 +3,16 @@ module Fog
3
3
  class OpenStack
4
4
  class V2
5
5
  class Real
6
- def create_zone_transfer_accept(key, zone_transfer_request_id)
6
+ def create_zone_transfer_accept(key, zone_transfer_request_id, options = {})
7
7
  data = {
8
8
  :key => key,
9
9
  :zone_transfer_request_id => zone_transfer_request_id
10
10
  }
11
11
 
12
+ headers, _options = Fog::DNS::OpenStack::V2.setup_headers(options)
13
+
12
14
  request(
15
+ :headers => headers,
13
16
  :body => Fog::JSON.encode(data),
14
17
  :expects => 200,
15
18
  :method => 'POST',
@@ -23,10 +23,21 @@ module Fog
23
23
  end
24
24
 
25
25
  def find_by_id(id)
26
- marker = 'X-Image-Meta-'
27
- params = service.get_image_by_id(id).headers.select{|h,_| h.include?(marker) }
28
- params = params.map{|k,v| [k.gsub(marker,'').downcase, convert_to_type(v)]}
29
- new(Hash[params])
26
+ marker = 'X-Image-Meta-'
27
+ property_marker = 'X-Image-Meta-Property-'
28
+ headers = service.get_image_by_id(id).headers.select { |h, _| h.start_with?(marker) }
29
+
30
+ # partioning on the longer prefix, leaving X-Image-Meta
31
+ # headers in the second returned hash.
32
+ custom_properties, params = headers.partition do |k, _|
33
+ k.start_with?(property_marker)
34
+ end.map { |p| Hash[p] }
35
+
36
+ params = remove_prefix_and_convert_type(params, marker)
37
+ custom_properties = remove_prefix_and_convert_type(custom_properties, property_marker)
38
+
39
+ params['properties'] = custom_properties
40
+ new(params)
30
41
  rescue Fog::Image::OpenStack::NotFound
31
42
  nil
32
43
  end
@@ -84,6 +95,10 @@ module Fog
84
95
  v
85
96
  end
86
97
  end
98
+
99
+ def remove_prefix_and_convert_type(hash, prefix)
100
+ Hash[hash.map { |k, v| [k.gsub(prefix, '').downcase, convert_to_type(v)] }]
101
+ end
87
102
  end
88
103
  end
89
104
  end
@@ -31,7 +31,8 @@ module Fog
31
31
  'X-Image-Meta-Protected' => 'False',
32
32
  'X-Image-Meta-Size' => 4979632,
33
33
  'X-Image-Meta-Status' => 'deactivated',
34
- 'X-Image-Meta-Updated_at' => '2016-02-25T03:02:05.000000'
34
+ 'X-Image-Meta-Updated_at' => '2016-02-25T03:02:05.000000',
35
+ 'X-Image-Meta-Property-foo' => 'bar'
35
36
  }
36
37
  response.body = {}
37
38
  response
@@ -2,7 +2,7 @@ module Fog
2
2
  module Metering
3
3
  class OpenStack
4
4
  class Real
5
- def get_samples(meter_id, options = [])
5
+ def get_samples(meter_id, options = [], limit = 10000000)
6
6
  data = {
7
7
  'q' => []
8
8
  }
@@ -15,6 +15,7 @@ module Fog
15
15
  end
16
16
 
17
17
  data['q'] << filter unless filter.empty?
18
+ data['limit'] = limit
18
19
  end
19
20
 
20
21
  request(
@@ -1,6 +1,6 @@
1
1
  module Fog
2
2
  module Openstack
3
- VERSION = "0.1.21"
3
+ VERSION = "0.1.22"
4
4
 
5
5
  def self.included(base)
6
6
  if RUBY_VERSION < "2"
@@ -27,6 +27,8 @@ module Fog
27
27
  collection :share_access_rules
28
28
  model :share_export_location
29
29
  collection :share_export_locations
30
+ model :availability_zone
31
+ collection :availability_zones
30
32
 
31
33
  request_path 'fog/shared_file_system/openstack/requests'
32
34
  # share networks
@@ -65,6 +67,9 @@ module Fog
65
67
  request :get_quota
66
68
  request :update_quota
67
69
 
70
+ # availability zones
71
+ request :list_availability_zones
72
+
68
73
  # rubocop:disable LineLength, Metrics/MethodLength, Metrics/ClassLength, Metrics/AbcSize
69
74
  class Mock
70
75
  def self.data
@@ -184,6 +189,14 @@ module Fog
184
189
  "name" => "snapshot_My_share"
185
190
  }
186
191
  ],
192
+ :availability_zones => [
193
+ {
194
+ "name" => "nova",
195
+ "created_at" => "2015-09-18T09:50:55.000000",
196
+ "updated_at" => nil,
197
+ "id" => "388c983d-258e-4a0e-b1ba-10da37d766db"
198
+ }
199
+ ],
187
200
  :snapshots_detail => [
188
201
  {
189
202
  "status" => "available",
@@ -223,7 +236,7 @@ module Fog
223
236
  "preferred" => false
224
237
  }
225
238
  ],
226
-
239
+
227
240
  :access_rules => [
228
241
  {
229
242
  "share_id" => "406ea93b-32e9-4907-a117-148b3945749f",
@@ -0,0 +1,15 @@
1
+ require 'fog/openstack/models/model'
2
+
3
+ module Fog
4
+ module SharedFileSystem
5
+ class OpenStack
6
+ class AvailabilityZone < Fog::OpenStack::Model
7
+ identity :id
8
+
9
+ attribute :name
10
+ attribute :created_at
11
+ attribute :updated_at
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ require 'fog/openstack/models/collection'
2
+ require 'fog/shared_file_system/openstack/models/availability_zone'
3
+
4
+ module Fog
5
+ module SharedFileSystem
6
+ class OpenStack
7
+ class AvailabilityZones < Fog::OpenStack::Collection
8
+ model Fog::SharedFileSystem::OpenStack::AvailabilityZone
9
+
10
+ def all
11
+ load_response(service.list_availability_zones(), 'availability_zones')
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,24 @@
1
+ module Fog
2
+ module SharedFileSystem
3
+ class OpenStack
4
+ class Real
5
+ def list_availability_zones()
6
+ request(
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :path => microversion_newer_than?('2.6') ? 'availability-zones' : 'os-availability-zone'
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def list_availability_zones()
16
+ response = Excon::Response.new
17
+ response.status = 200
18
+ response.body = {'availability_zones' => data[:availability_zones]}
19
+ response
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -37,6 +37,7 @@ module Fog
37
37
  request :head_object
38
38
  request :put_container
39
39
  request :put_object
40
+ request :post_object
40
41
  request :put_object_manifest
41
42
  request :put_dynamic_obj_manifest
42
43
  request :put_static_obj_manifest
@@ -33,6 +33,11 @@ module Fog
33
33
  # @see http://docs.openstack.org/developer/swift/api/use_content-encoding_metadata.html#use-content-encoding-metadata
34
34
  attribute :content_encoding, :aliases => 'Content-Encoding'
35
35
 
36
+ def initialize(new_attributes = {})
37
+ super
38
+ @dirty = if last_modified then false else true end
39
+ end
40
+
36
41
  def body
37
42
  attributes[:body] ||= if last_modified
38
43
  collection.get(identity).body
@@ -43,6 +48,7 @@ module Fog
43
48
 
44
49
  def body=(new_body)
45
50
  attributes[:body] = new_body
51
+ @dirty = true
46
52
  end
47
53
 
48
54
  attr_reader :directory
@@ -61,6 +67,7 @@ module Fog
61
67
  def destroy
62
68
  requires :directory, :key
63
69
  service.delete_object(directory.key, key)
70
+ @dirty = true
64
71
  true
65
72
  end
66
73
 
@@ -100,7 +107,7 @@ module Fog
100
107
  end
101
108
 
102
109
  def save(options = {})
103
- requires :body, :directory, :key
110
+ requires :directory, :key
104
111
  options['Content-Type'] = content_type if content_type
105
112
  options['Content-Disposition'] = content_disposition if content_disposition
106
113
  options['Access-Control-Allow-Origin'] = access_control_allow_origin if access_control_allow_origin
@@ -110,12 +117,17 @@ module Fog
110
117
  options['Content-Encoding'] = content_encoding if content_encoding
111
118
  options.merge!(metadata_to_headers)
112
119
 
113
- data = service.put_object(directory.key, key, body, options)
120
+ if not @dirty
121
+ data = service.post_object(directory.key, key, options)
122
+ else
123
+ requires :body
124
+ data = service.put_object(directory.key, key, body, options)
125
+ self.content_length = Fog::Storage.get_body_size(body)
126
+ self.content_type ||= Fog::Storage.get_content_type(body)
127
+ end
114
128
  update_attributes_from(data)
115
129
  refresh_metadata
116
130
 
117
- self.content_length = Fog::Storage.get_body_size(body)
118
- self.content_type ||= Fog::Storage.get_content_type(body)
119
131
  true
120
132
  end
121
133
 
@@ -53,7 +53,7 @@ module Fog
53
53
  object_path_unescaped = "#{@path}/#{Fog::OpenStack.escape(container)}/#{object}"
54
54
  string_to_sign = "#{method}\n#{expires}\n#{object_path_unescaped}"
55
55
 
56
- hmac = Fog::HMAC.new('sha1', @openstack_temp_url_key)
56
+ hmac = Fog::HMAC.new('sha1', @openstack_temp_url_key.to_s)
57
57
  sig = sig_to_hex(hmac.sign(string_to_sign))
58
58
 
59
59
  temp_url_options = {
@@ -0,0 +1,26 @@
1
+ module Fog
2
+ module Storage
3
+ class OpenStack
4
+ class Real
5
+ # Update object metadata
6
+ #
7
+ # ==== Parameters
8
+ # * container<~String> - Name for container, should be < 256 bytes and must not contain '/'
9
+ # * object<~String> - Name for object
10
+ # * headers<~Hash> - metadata headers for object. Defaults to {}.
11
+ #
12
+ def post_object(container, object, headers = {})
13
+
14
+ params = {
15
+ :expects => 202,
16
+ :headers => headers,
17
+ :method => 'POST',
18
+ :path => "#{Fog::OpenStack.escape(container)}/#{Fog::OpenStack.escape(object)}"
19
+ }
20
+
21
+ request(params)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,16 @@
1
+ module Fog
2
+ module Volume
3
+ class OpenStack
4
+ module Real
5
+ def snapshot_action(id, data)
6
+ request(
7
+ :body => Fog::JSON.encode(data),
8
+ :expects => [200, 202],
9
+ :method => 'POST',
10
+ :path => "snapshots/#{id}/action"
11
+ )
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -84,6 +84,7 @@ module Fog
84
84
 
85
85
  request :set_tenant
86
86
  request :action
87
+ request :snapshot_action
87
88
 
88
89
  class Mock
89
90
  def self.data
@@ -0,0 +1,2 @@
1
+ require 'fog/volume/openstack/requests/snapshot_action'
2
+ require 'fog/volume/openstack/v2/requests/real'
@@ -2,30 +2,34 @@
2
2
 
3
3
  ## Supported
4
4
 
5
- | Project | Fog Type | API Version(s) | Compliance | Notes |
6
- |------------------|---------------|----------------|------------|-------|
7
- | Ceilometer | Metering | v2 | TBD | |
8
- | Cinder | Volume | v1, v2 | TBD | |
9
- | Glance | Image | v1, v2 | TBD | |
10
- | Heat | Orchestration | v1 | TBD | |
11
- | Keystone | Identity | v2, v3 | TBD | |
12
- | Neutron | Network | v2 | TBD | |
13
- | Nova | Compute | v2.0 | TBD | |
14
- | Ironic | Bare Metal | v1 | TBD | |
15
- | Ironic Inspector | Introspection | v1 | TBD | |
16
- | Swift | Storage | v2 | TBD | |
17
- | Tacker | NFV | v1 | TBD | |
5
+ | Project | Fog Type | API Version(s) | Compliance | Notes |
6
+ |------------------|--------------------|----------------|------------|-------|
7
+ | Barbican | Key Manager | v1 | TBD | |
8
+ | Ceilometer | Metering | v2 | TBD | |
9
+ | Cinder | Volume | v1, v2 | TBD | |
10
+ | Designate | DNS | v1, v2 | TBD | |
11
+ | Glance | Image | v1, v2 | TBD | |
12
+ | Gnocci | Metric | v1 | TBD | |
13
+ | Heat | Orchestration | v1 | TBD | |
14
+ | Ironic | Bare Metal | v1 | TBD | |
15
+ | Ironic Inspector | Introspection | v1 | TBD | |
16
+ | Keystone | Identity | v2, v3 | TBD | |
17
+ | Magnum | Container Infra | v1 | TBD | |
18
+ | Manila | Shared File System | v2.0 | TBD | |
19
+ | Mistral | Workflow | v2.0 | TBD | |
20
+ | Monasca | Monitoring | v2.0 | TBD | |
21
+ | Neutron | Network | v2 | TBD | |
22
+ | Nova | Compute | v2.0 | TBD | |
23
+ | Panko | Event | v2 | TBD | |
24
+ | Swift | Storage | v2 | TBD | |
25
+ | Tacker | NFV | v1 | TBD | |
26
+ | Tuskar | TripleO Planning | v1 | TBD | |
18
27
 
19
28
  ## Wish List
20
29
 
21
30
  Feel free to submit pull requests to add support for these.
22
31
 
23
- * [barbican](https://wiki.openstack.org/wiki/Barbican) (Key Management)
24
32
  * [congress](https://wiki.openstack.org/wiki/Congress) (Policy As a Service)
25
- * [designate](https://wiki.openstack.org/wiki/Designate) (DNSaaS)
26
- * [magnum](https://wiki.openstack.org/wiki/Magnum) (Containers)
27
- * [manila](https://wiki.openstack.org/wiki/Manila) (File Storage)
28
- * [monasca](https://wiki.openstack.org/wiki/Monasca) (Monitoring)
29
33
  * [trove](https://wiki.openstack.org/wiki/Trove) (DBaaS)
30
34
 
31
35
  ## Unsupported
@@ -38,11 +42,9 @@ Feel free to submit pull requests to add support for these.
38
42
  * ec2-api (Compatibility Layer)
39
43
  * freezer (Disaster Recovery)
40
44
  * fuel (Orchestration)
41
- * gnocchi (TSDB)
42
45
  * horizon (Web Frontend)
43
46
  * kolla (Containers)
44
47
  * kuryr (Containers)
45
- * mistral (Workflow)
46
48
  * murano (Catalog Service)
47
49
  * rally (Benchmarking)
48
50
  * sahara (Map-Reduce)
metadata CHANGED
@@ -1,195 +1,195 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-openstack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.21
4
+ version: 0.1.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Darby
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-10 00:00:00.000000000 Z
11
+ date: 2017-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.40'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.40'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: fog-json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ipaddress
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.8'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.8'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.6'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.6'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: mime-types
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: mime-types-data
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '10.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '10.0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rubocop
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rubyzip
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: 0.9.9
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: 0.9.9
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: shindo
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ~>
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0.3'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ~>
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0.3'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: minitest
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - '>='
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - '>='
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: vcr
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - '>='
171
+ - - ">="
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - '>='
178
+ - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: webmock
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - ~>
185
+ - - "~>"
186
186
  - !ruby/object:Gem::Version
187
187
  version: 1.24.6
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - ~>
192
+ - - "~>"
193
193
  - !ruby/object:Gem::Version
194
194
  version: 1.24.6
195
195
  description: OpenStack fog provider gem.
@@ -199,13 +199,12 @@ executables: []
199
199
  extensions: []
200
200
  extra_rdoc_files: []
201
201
  files:
202
- - .envrc_empty
203
- - .gitignore
204
- - .hound.yml
205
- - .rubocop.yml
206
- - .ruby-gemset
207
- - .ruby-version
208
- - .travis.yml
202
+ - ".gitignore"
203
+ - ".hound.yml"
204
+ - ".rubocop.yml"
205
+ - ".ruby-gemset"
206
+ - ".ruby-version"
207
+ - ".travis.yml"
209
208
  - CHANGELOG.md
210
209
  - CODE_OF_CONDUCT.md
211
210
  - CONTRIBUTING.md
@@ -1059,6 +1058,8 @@ files:
1059
1058
  - lib/fog/planning/openstack/requests/patch_plan.rb
1060
1059
  - lib/fog/planning/openstack/requests/remove_role_from_plan.rb
1061
1060
  - lib/fog/shared_file_system/openstack.rb
1061
+ - lib/fog/shared_file_system/openstack/models/availability_zone.rb
1062
+ - lib/fog/shared_file_system/openstack/models/availability_zones.rb
1062
1063
  - lib/fog/shared_file_system/openstack/models/network.rb
1063
1064
  - lib/fog/shared_file_system/openstack/models/networks.rb
1064
1065
  - lib/fog/shared_file_system/openstack/models/share.rb
@@ -1083,6 +1084,7 @@ files:
1083
1084
  - lib/fog/shared_file_system/openstack/requests/get_share_network.rb
1084
1085
  - lib/fog/shared_file_system/openstack/requests/get_snapshot.rb
1085
1086
  - lib/fog/shared_file_system/openstack/requests/grant_share_access.rb
1087
+ - lib/fog/shared_file_system/openstack/requests/list_availability_zones.rb
1086
1088
  - lib/fog/shared_file_system/openstack/requests/list_share_access_rules.rb
1087
1089
  - lib/fog/shared_file_system/openstack/requests/list_share_export_locations.rb
1088
1090
  - lib/fog/shared_file_system/openstack/requests/list_share_networks.rb
@@ -1116,6 +1118,7 @@ files:
1116
1118
  - lib/fog/storage/openstack/requests/head_container.rb
1117
1119
  - lib/fog/storage/openstack/requests/head_containers.rb
1118
1120
  - lib/fog/storage/openstack/requests/head_object.rb
1121
+ - lib/fog/storage/openstack/requests/post_object.rb
1119
1122
  - lib/fog/storage/openstack/requests/post_set_meta_temp_url_key.rb
1120
1123
  - lib/fog/storage/openstack/requests/public_url.rb
1121
1124
  - lib/fog/storage/openstack/requests/put_container.rb
@@ -1172,6 +1175,7 @@ files:
1172
1175
  - lib/fog/volume/openstack/requests/replace_metadata.rb
1173
1176
  - lib/fog/volume/openstack/requests/restore_backup.rb
1174
1177
  - lib/fog/volume/openstack/requests/set_tenant.rb
1178
+ - lib/fog/volume/openstack/requests/snapshot_action.rb
1175
1179
  - lib/fog/volume/openstack/requests/update_metadata.rb
1176
1180
  - lib/fog/volume/openstack/requests/update_quota.rb
1177
1181
  - lib/fog/volume/openstack/requests/update_snapshot.rb
@@ -1285,6 +1289,7 @@ files:
1285
1289
  - lib/fog/volume/openstack/v2/requests/replace_metadata.rb
1286
1290
  - lib/fog/volume/openstack/v2/requests/restore_backup.rb
1287
1291
  - lib/fog/volume/openstack/v2/requests/set_tenant.rb
1292
+ - lib/fog/volume/openstack/v2/requests/snapshot_action.rb
1288
1293
  - lib/fog/volume/openstack/v2/requests/update_metadata.rb
1289
1294
  - lib/fog/volume/openstack/v2/requests/update_quota.rb
1290
1295
  - lib/fog/volume/openstack/v2/requests/update_snapshot.rb
@@ -1345,17 +1350,17 @@ require_paths:
1345
1350
  - lib
1346
1351
  required_ruby_version: !ruby/object:Gem::Requirement
1347
1352
  requirements:
1348
- - - '>='
1353
+ - - ">="
1349
1354
  - !ruby/object:Gem::Version
1350
1355
  version: '0'
1351
1356
  required_rubygems_version: !ruby/object:Gem::Requirement
1352
1357
  requirements:
1353
- - - '>='
1358
+ - - ">="
1354
1359
  - !ruby/object:Gem::Version
1355
1360
  version: '0'
1356
1361
  requirements: []
1357
1362
  rubyforge_project:
1358
- rubygems_version: 2.4.8
1363
+ rubygems_version: 2.6.13
1359
1364
  signing_key:
1360
1365
  specification_version: 4
1361
1366
  summary: OpenStack fog provider gem
File without changes