fog 0.3.11 → 0.3.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fog (0.3.11)
4
+ fog (0.3.12)
5
5
  builder
6
6
  excon (>= 0.2.4)
7
7
  formatador (>= 0.0.15)
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  ## If your rubyforge_project name is different, then edit it and comment out
8
8
  ## the sub! line in the Rakefile
9
9
  s.name = 'fog'
10
- s.version = '0.3.11'
10
+ s.version = '0.3.12'
11
11
  s.date = '2010-10-20'
12
12
  s.rubyforge_project = 'fog'
13
13
 
@@ -375,12 +375,15 @@ Gem::Specification.new do |s|
375
375
  lib/fog/rackspace/requests/compute/update_server.rb
376
376
  lib/fog/rackspace/requests/storage/delete_container.rb
377
377
  lib/fog/rackspace/requests/storage/delete_object.rb
378
+ lib/fog/rackspace/requests/storage/get_cdn_containers.rb
378
379
  lib/fog/rackspace/requests/storage/get_container.rb
379
380
  lib/fog/rackspace/requests/storage/get_containers.rb
380
381
  lib/fog/rackspace/requests/storage/get_object.rb
382
+ lib/fog/rackspace/requests/storage/head_cdn_container.rb
381
383
  lib/fog/rackspace/requests/storage/head_container.rb
382
384
  lib/fog/rackspace/requests/storage/head_containers.rb
383
385
  lib/fog/rackspace/requests/storage/head_object.rb
386
+ lib/fog/rackspace/requests/storage/put_cdn_container.rb
384
387
  lib/fog/rackspace/requests/storage/put_container.rb
385
388
  lib/fog/rackspace/requests/storage/put_object.rb
386
389
  lib/fog/rackspace/servers.rb
data/lib/fog.rb CHANGED
@@ -24,7 +24,7 @@ module Fog
24
24
  @mocking = false
25
25
 
26
26
  unless const_defined?(:VERSION)
27
- VERSION = '0.3.11'
27
+ VERSION = '0.3.12'
28
28
  end
29
29
 
30
30
  module Mock
@@ -182,8 +182,7 @@ module Fog
182
182
 
183
183
  def ssh(commands)
184
184
  requires :identity, :ip_address, :private_key, :username
185
- @ssh ||= Fog::SSH.new(ip_address, username, :key_data => [private_key])
186
- @ssh.run(commands)
185
+ Fog::SSH.new(ip_address, username, :key_data => [private_key]).run(commands)
187
186
  end
188
187
 
189
188
  def start
@@ -46,7 +46,7 @@ module Fog
46
46
  'Action' => 'DescribeImages',
47
47
  :idempotent => true,
48
48
  :parser => Fog::Parsers::AWS::Compute::DescribeImages.new
49
- }.merge!(options))
49
+ }.merge!(params))
50
50
  end
51
51
 
52
52
  end
@@ -109,8 +109,7 @@ module Fog
109
109
 
110
110
  def ssh(commands)
111
111
  requires :identity, :ips, :private_key, :username
112
- @ssh ||= Fog::SSH.new(ips.first['address'], username, :key_data => [private_key])
113
- @ssh.run(commands)
112
+ Fog::SSH.new(ips.first['address'], username, :key_data => [private_key]).run(commands)
114
113
  end
115
114
 
116
115
  def username
@@ -51,8 +51,7 @@ module Fog
51
51
  begin
52
52
  Net::SSH.start(@address, @username, @options) do |ssh|
53
53
  commands.each do |command|
54
- sudoable_command = command.sub(/^sudo/, %{sudo -p 'fog sudo password:'})
55
- escaped_command = sudoable_command.sub(/'/, %{'"'"'})
54
+ escaped_command = command.sub(/'/, %{'"'"'})
56
55
  result = Result.new(escaped_command)
57
56
  ssh.open_channel do |ssh_channel|
58
57
  ssh_channel.request_pty
@@ -105,8 +105,7 @@ module Fog
105
105
 
106
106
  def ssh(commands)
107
107
  requires :addresses, :identity, :private_key, :username
108
- @ssh ||= Fog::SSH.new(addresses['public'].first, username, :key_data => [private_key])
109
- @ssh.run(commands)
108
+ Fog::SSH.new(addresses['public'].first, username, :key_data => [private_key]).run(commands)
110
109
  end
111
110
 
112
111
  def username
@@ -0,0 +1,39 @@
1
+ module Fog
2
+ module Rackspace
3
+ class Storage
4
+ class Real
5
+
6
+ # List existing cdn-enabled storage containers
7
+ #
8
+ # ==== Parameters
9
+ # * options<~Hash>:
10
+ # * 'enabled_only'<~Boolean> - Set to true to limit results to cdn enabled containers
11
+ # * 'limit'<~Integer> - Upper limit to number of results returned
12
+ # * 'marker'<~String> - Only return objects with name greater than this value
13
+ #
14
+ # ==== Returns
15
+ # * response<~Excon::Response>:
16
+ # * body<~Array>:
17
+ # * container<~String>: Name of container
18
+ def get_cdn_containers(options = {})
19
+ response = cdn_request(
20
+ :expects => [200, 204],
21
+ :method => 'GET',
22
+ :path => '',
23
+ :query => {'format' => 'json'}.merge!(options)
24
+ )
25
+ response
26
+ end
27
+
28
+ end
29
+
30
+ class Mock
31
+
32
+ def get_cdn_containers(options = {})
33
+ Fog::Mock.not_implemented
34
+ end
35
+
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,41 @@
1
+ module Fog
2
+ module Rackspace
3
+ class Storage
4
+ class Real
5
+
6
+ # List cdn properties for a container
7
+ #
8
+ # ==== Parameters
9
+ # * container<~String> - Name of container to retrieve info for
10
+ #
11
+ # ==== Returns
12
+ # * response<~Excon::Response>:
13
+ # * headers<~Hash>:
14
+ # * 'X-CDN-Enabled'<~Boolean> - cdn status for container
15
+ # * 'X-CDN-URI'<~String> - cdn url for this container
16
+ # * 'X-TTL'<~String> - integer seconds before data expires, defaults to 86400 (1 day)
17
+ # * 'X-Log-Retention'<~Boolean> - ?
18
+ # * 'X-User-Agent-ACL'<~String> - ?
19
+ # * 'X-Referrer-ACL'<~String> - ?
20
+ def head_cdn_container(container)
21
+ response = cdn_request(
22
+ :expects => 204,
23
+ :method => 'HEAD',
24
+ :path => container,
25
+ :query => {'format' => 'json'}
26
+ )
27
+ response
28
+ end
29
+
30
+ end
31
+
32
+ class Mock
33
+
34
+ def head_cdn_container(container)
35
+ Fog::Mock.not_implemented
36
+ end
37
+
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,38 @@
1
+ module Fog
2
+ module Rackspace
3
+ class Storage
4
+ class Real
5
+
6
+ # modify CDN properties for a container
7
+ #
8
+ # ==== Parameters
9
+ # * name<~String> - Name for container, should be < 256 bytes and must not contain '/'
10
+ # # options<~Hash>:
11
+ # * 'X-CDN-Enabled'<~Boolean> - cdn status for container
12
+ # * 'X-CDN-URI'<~String> - cdn url for this container
13
+ # * 'X-TTL'<~String> - integer seconds before data expires, defaults to 86400 (1 day), in 3600..259200
14
+ # * 'X-Log-Retention'<~Boolean> - ?
15
+ # * 'X-User-Agent-ACL'<~String> - ?
16
+ # * 'X-Referrer-ACL'<~String> - ?
17
+ def put_cdn_container(name, options = {})
18
+ response = cdn_request(
19
+ :expects => [201, 202],
20
+ :headers => options,
21
+ :method => 'PUT',
22
+ :path => CGI.escape(name)
23
+ )
24
+ response
25
+ end
26
+
27
+ end
28
+
29
+ class Mock
30
+
31
+ def put_cdn_container(name, options = {})
32
+ Fog::Mock.not_implemented
33
+ end
34
+
35
+ end
36
+ end
37
+ end
38
+ end
@@ -14,11 +14,14 @@ module Fog
14
14
  request :delete_container
15
15
  request :delete_object
16
16
  request :get_container
17
+ request :get_cdn_containers
17
18
  request :get_containers
18
19
  request :get_object
20
+ request :head_cdn_container
19
21
  request :head_container
20
22
  request :head_containers
21
23
  request :head_object
24
+ request :put_cdn_container
22
25
  request :put_container
23
26
  request :put_object
24
27
 
@@ -94,10 +97,11 @@ module Fog
94
97
  end
95
98
 
96
99
  def reload
97
- @connection.reset
100
+ @cdn_connection.reset
101
+ @storage_connection.reset
98
102
  end
99
103
 
100
- def cdn_request(params)
104
+ def cdn_request(params, parse_json = true)
101
105
  begin
102
106
  response = @cdn_connection.request(params.merge!({
103
107
  :headers => {
@@ -95,8 +95,7 @@ module Fog
95
95
 
96
96
  def ssh(commands)
97
97
  requires :addresses, :identity, :private_key, :username
98
- @ssh ||= Fog::SSH.new(addresses.first, username, :key_data => [private_key])
99
- @ssh.run(commands)
98
+ Fog::SSH.new(addresses.first, username, :key_data => [private_key]).run(commands)
100
99
  end
101
100
 
102
101
  def username
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 11
9
- version: 0.3.11
8
+ - 12
9
+ version: 0.3.12
10
10
  platform: ruby
11
11
  authors:
12
12
  - geemus (Wesley Beary)
@@ -482,12 +482,15 @@ files:
482
482
  - lib/fog/rackspace/requests/compute/update_server.rb
483
483
  - lib/fog/rackspace/requests/storage/delete_container.rb
484
484
  - lib/fog/rackspace/requests/storage/delete_object.rb
485
+ - lib/fog/rackspace/requests/storage/get_cdn_containers.rb
485
486
  - lib/fog/rackspace/requests/storage/get_container.rb
486
487
  - lib/fog/rackspace/requests/storage/get_containers.rb
487
488
  - lib/fog/rackspace/requests/storage/get_object.rb
489
+ - lib/fog/rackspace/requests/storage/head_cdn_container.rb
488
490
  - lib/fog/rackspace/requests/storage/head_container.rb
489
491
  - lib/fog/rackspace/requests/storage/head_containers.rb
490
492
  - lib/fog/rackspace/requests/storage/head_object.rb
493
+ - lib/fog/rackspace/requests/storage/put_cdn_container.rb
491
494
  - lib/fog/rackspace/requests/storage/put_container.rb
492
495
  - lib/fog/rackspace/requests/storage/put_object.rb
493
496
  - lib/fog/rackspace/servers.rb