fog-openstack 0.1.24 → 0.1.25

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77699371cb9d1cea2f5ced1bc246594c70b412da
4
- data.tar.gz: 875158fd7550f7714b0f4082ec8e7a9a0b4684ef
3
+ metadata.gz: e7747fff8d19d57ebe37075c44556ec030fed69b
4
+ data.tar.gz: a5f2d60b3888fa2053a26ed6d9e16707ef20136e
5
5
  SHA512:
6
- metadata.gz: 46745f15db6c180aa55ead7a7ae8246b73bfcd489c54feb8f929b5678b9dfb9b74a0a9ecbec18697c9e70d72fce98519e8df4a017cd7638f132e0a74dda3cfba
7
- data.tar.gz: 2a683b1003fbfd0dc25f22e59be0c7c02acdc615bb1fbffc8cccf66991162d6ff849d776aa75d6955d6ed823ecc72869212fd33dffe2637096012f11bdd570a3
6
+ metadata.gz: 853b8e7811143a70ba0fdf6806c8ef9c1646b1f83b391196ce2373189f3a054a55c44ba4e7d2cafa96a4115fcbafce50aa860b441e7770d782973151087eff4f
7
+ data.tar.gz: 488bd961ef8ef1df45f744dc96451dba5b63af7800e45e9faeb2be9a68c64604b9216bc2f48646a0ff8ff44d815d2ba06104dee8776871d50e7c12ea05264bbe
@@ -227,12 +227,16 @@ module Fog
227
227
  end
228
228
 
229
229
  def security_groups
230
- requires :id
230
+ if id
231
+ requires :id
231
232
 
232
- groups = service.list_security_groups(:server_id => id).body['security_groups']
233
+ groups = service.list_security_groups(:server_id => id).body['security_groups']
233
234
 
234
- groups.map do |group|
235
- Fog::Compute::OpenStack::SecurityGroup.new group.merge(:service => service)
235
+ groups.map do |group|
236
+ Fog::Compute::OpenStack::SecurityGroup.new group.merge(:service => service)
237
+ end
238
+ else
239
+ service.security_groups.all
236
240
  end
237
241
  end
238
242
 
@@ -13,7 +13,7 @@ module Fog
13
13
 
14
14
  request(
15
15
  :body => Fog::JSON.encode(data),
16
- :expects => 200,
16
+ :expects => [200, 201],
17
17
  :method => 'POST',
18
18
  :path => 'os-keypairs'
19
19
  )
@@ -4,7 +4,7 @@ module Fog
4
4
  class Real
5
5
  def delete_key_pair(key_name)
6
6
  request(
7
- :expects => 202,
7
+ :expects => [202, 204],
8
8
  :method => 'DELETE',
9
9
  :path => "os-keypairs/#{Fog::OpenStack.escape(key_name)}"
10
10
  )
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Openstack
3
- VERSION = "0.1.24"
3
+ VERSION = "0.1.25"
4
4
  end
5
5
  end
@@ -74,7 +74,15 @@ module Fog
74
74
  require_mime_types
75
75
  @openstack_api_key = options[:openstack_api_key]
76
76
  @openstack_username = options[:openstack_username]
77
- @path = '/v1/AUTH_1234'
77
+ @openstack_management_url = options[:openstack_management_url] || 'http://example:8774/v2/AUTH_1234'
78
+
79
+ @openstack_management_uri = URI.parse(@openstack_management_url)
80
+
81
+ @host = @openstack_management_uri.host
82
+ @path = @openstack_management_uri.path
83
+ @path.sub!(%r{/$}, '')
84
+ @port = @openstack_management_uri.port
85
+ @scheme = @openstack_management_uri.scheme
78
86
  end
79
87
 
80
88
  def data
@@ -40,7 +40,7 @@ module Fog
40
40
 
41
41
  def body
42
42
  attributes[:body] ||= if last_modified
43
- collection.get(identity).body
43
+ collection.get(identity).try(:body) || ''
44
44
  else
45
45
  ''
46
46
  end
@@ -1,7 +1,7 @@
1
1
  module Fog
2
2
  module Storage
3
3
  class OpenStack
4
- class Real
4
+ module PublicUrl
5
5
  # Get public_url for an object
6
6
  #
7
7
  # ==== Parameters
@@ -21,6 +21,14 @@ module Fog
21
21
  "#{@scheme}://#{@host}:#{@port}#{@path}"
22
22
  end
23
23
  end
24
+
25
+ class Real
26
+ include PublicUrl
27
+ end
28
+
29
+ class Mock
30
+ include PublicUrl
31
+ end
24
32
  end
25
33
  end
26
34
  end
@@ -36,6 +36,30 @@ module Fog
36
36
  request(params)
37
37
  end
38
38
  end
39
+
40
+ class Mock
41
+ require 'digest'
42
+
43
+ def put_object(container, object, data, options = {}, &block)
44
+ dgst = Digest::MD5.new
45
+ if block_given?
46
+ Kernel.loop do
47
+ chunk = yield
48
+ break if chunk.empty?
49
+ dgst.update chunk
50
+ end
51
+ elsif data.kind_of?(String)
52
+ dgst.update data
53
+ else
54
+ dgst.file data
55
+ end
56
+ response = Excon::Response.new
57
+ response.status = 201
58
+ response.body = ''
59
+ response.headers = {'ETag' => dgst.hexdigest}
60
+ response
61
+ end
62
+ end
39
63
  end
40
64
  end
41
65
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-openstack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.24
4
+ version: 0.1.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Darby
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-20 00:00:00.000000000 Z
11
+ date: 2018-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core
@@ -1361,7 +1361,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1361
1361
  version: '0'
1362
1362
  requirements: []
1363
1363
  rubyforge_project:
1364
- rubygems_version: 2.6.13
1364
+ rubygems_version: 2.6.14.1
1365
1365
  signing_key:
1366
1366
  specification_version: 4
1367
1367
  summary: OpenStack fog provider gem