fog 0.3.9 → 0.3.10
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.rdoc +1 -1
- data/bin/fog +10 -7
- data/fog.gemspec +3 -2
- data/lib/fog.rb +5 -1
- data/lib/fog/aws/models/compute/server.rb +14 -8
- data/lib/fog/aws/models/compute/servers.rb +8 -6
- data/lib/fog/aws/requests/storage/get_bucket.rb +3 -0
- data/lib/fog/aws/requests/storage/post_object_hidden_fields.rb +49 -0
- data/lib/fog/aws/storage.rb +1 -0
- data/lib/fog/bluebox/models/compute/server.rb +6 -4
- data/lib/fog/core/collection.rb +1 -1
- data/lib/fog/core/credentials.rb +1 -0
- data/lib/fog/rackspace/models/compute/server.rb +6 -4
- data/lib/fog/slicehost/models/compute/server.rb +6 -4
- metadata +4 -3
data/Gemfile.lock
CHANGED
data/README.rdoc
CHANGED
data/bin/fog
CHANGED
@@ -12,8 +12,17 @@ end
|
|
12
12
|
|
13
13
|
require 'fog/core/bin'
|
14
14
|
|
15
|
+
providers = Fog.providers.map{|provider| provider.to_s}
|
16
|
+
providers = if providers.length > 1
|
17
|
+
providers[0...-1].join(', ') << ' and ' << providers[-1]
|
18
|
+
else
|
19
|
+
providers.first
|
20
|
+
end
|
21
|
+
|
15
22
|
if ARGV.length > 1
|
16
|
-
|
23
|
+
|
24
|
+
puts(instance_eval(ARGV[1..-1].join(' ')).to_json)
|
25
|
+
|
17
26
|
else
|
18
27
|
|
19
28
|
ARGV.clear # Avoid passing args to IRB
|
@@ -25,12 +34,6 @@ else
|
|
25
34
|
@irb.context.prompt_mode = :FOG
|
26
35
|
@irb.context.workspace = IRB::WorkSpace.new(binding)
|
27
36
|
|
28
|
-
providers = Fog.providers.map{|provider| provider.to_s}
|
29
|
-
providers = if providers.length > 1
|
30
|
-
providers[0...-1].join(', ') << ' and ' << providers[-1]
|
31
|
-
else
|
32
|
-
providers.first
|
33
|
-
end
|
34
37
|
Formatador.display_line('Welcome to fog interactive!')
|
35
38
|
Formatador.display_line(":#{Fog.credential.to_s} credentials provide #{providers}")
|
36
39
|
providers = Fog.providers
|
data/fog.gemspec
CHANGED
@@ -7,8 +7,8 @@ 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
|
-
s.date = '2010-10-
|
10
|
+
s.version = '0.3.10'
|
11
|
+
s.date = '2010-10-20'
|
12
12
|
s.rubyforge_project = 'fog'
|
13
13
|
|
14
14
|
## Make sure your summary is short. The description may be as long
|
@@ -222,6 +222,7 @@ Gem::Specification.new do |s|
|
|
222
222
|
lib/fog/aws/requests/storage/get_request_payment.rb
|
223
223
|
lib/fog/aws/requests/storage/get_service.rb
|
224
224
|
lib/fog/aws/requests/storage/head_object.rb
|
225
|
+
lib/fog/aws/requests/storage/post_object_hidden_fields.rb
|
225
226
|
lib/fog/aws/requests/storage/put_bucket.rb
|
226
227
|
lib/fog/aws/requests/storage/put_bucket_acl.rb
|
227
228
|
lib/fog/aws/requests/storage/put_bucket_logging.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.
|
27
|
+
VERSION = '0.3.10'
|
28
28
|
end
|
29
29
|
|
30
30
|
module Mock
|
@@ -52,6 +52,10 @@ module Fog
|
|
52
52
|
@bin = new_bin
|
53
53
|
end
|
54
54
|
|
55
|
+
def self.credentials
|
56
|
+
{}
|
57
|
+
end
|
58
|
+
|
55
59
|
def self.mock!
|
56
60
|
@mocking = true
|
57
61
|
end
|
@@ -104,20 +104,23 @@ module Fog
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def private_key_path
|
107
|
-
|
107
|
+
@private_key_path ||= Fog.credentials[:private_key_path]
|
108
|
+
@private_key_path &&= File.expand_path(@private_key_path)
|
108
109
|
end
|
109
110
|
|
110
111
|
def private_key
|
111
|
-
@private_key ||= File.read(private_key_path)
|
112
|
+
@private_key ||= private_key_path && File.read(private_key_path)
|
112
113
|
end
|
113
114
|
|
114
115
|
def public_key_path
|
115
|
-
|
116
|
+
@public_key_path ||= Fog.credentials[:public_key_path]
|
117
|
+
@public_key_path &&= File.expand_path(@public_key_path)
|
116
118
|
end
|
117
119
|
|
118
120
|
def public_key
|
119
|
-
@public_key ||= File.read(public_key_path)
|
121
|
+
@public_key ||= public_key_path && File.read(public_key_path)
|
120
122
|
end
|
123
|
+
|
121
124
|
def ready?
|
122
125
|
@state == 'running'
|
123
126
|
end
|
@@ -161,14 +164,17 @@ module Fog
|
|
161
164
|
end
|
162
165
|
|
163
166
|
def setup(credentials = {})
|
164
|
-
requires :identity, :ip_address, :
|
167
|
+
requires :identity, :ip_address, :username
|
165
168
|
sleep(10) # takes a bit before EC2 instances will play nice
|
166
|
-
|
169
|
+
commands = [
|
167
170
|
%{mkdir .ssh},
|
168
|
-
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
169
171
|
%{passwd -l root},
|
170
172
|
%{echo "#{attributes.to_json}" >> ~/attributes.json}
|
171
|
-
]
|
173
|
+
]
|
174
|
+
if public_key
|
175
|
+
commands << %{echo "#{public_key}" >> ~/.ssh/authorized_keys}
|
176
|
+
end
|
177
|
+
Fog::SSH.new(ip_address, username, credentials).run(commands)
|
172
178
|
rescue Errno::ECONNREFUSED => e
|
173
179
|
sleep(1)
|
174
180
|
retry
|
@@ -37,13 +37,15 @@ module Fog
|
|
37
37
|
def bootstrap(new_attributes = {})
|
38
38
|
server = connection.servers.new(new_attributes)
|
39
39
|
|
40
|
-
|
41
|
-
|
40
|
+
unless new_attributes[:key_name]
|
41
|
+
# first or create fog_#{credential} keypair
|
42
42
|
name = Fog.respond_to?(:credential) && Fog.credential || :default
|
43
|
-
server.key_pair = connection.key_pairs.
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
unless server.key_pair = connection.key_pairs.get("fog_#{name}")
|
44
|
+
server.key_pair = connection.key_pairs.create(
|
45
|
+
:name => "fog_#{name}",
|
46
|
+
:public_key => server.public_key
|
47
|
+
)
|
48
|
+
end
|
47
49
|
end
|
48
50
|
|
49
51
|
# make sure port 22 is open in the first security group
|
@@ -59,6 +59,9 @@ module Fog
|
|
59
59
|
unless bucket_name
|
60
60
|
raise ArgumentError.new('bucket_name is required')
|
61
61
|
end
|
62
|
+
if options['delimiter']
|
63
|
+
Fog::Mock.not_implemented
|
64
|
+
end
|
62
65
|
response = Excon::Response.new
|
63
66
|
if bucket = @data[:buckets][bucket_name]
|
64
67
|
contents = bucket[:objects].values.sort {|x,y| x['Key'] <=> y['Key']}.reject do |object|
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class Storage
|
4
|
+
class Real
|
5
|
+
|
6
|
+
# Get a hash of hidden fields for form uploading to S3, in the form {:field_name => :field_value}
|
7
|
+
# Form should look like: <form action="http://#{bucket_name}.s3.amazonaws.com/" method="post" enctype="multipart/form-data">
|
8
|
+
# These hidden fields should then appear, followed by a field named 'file' which is either a textarea or file input.
|
9
|
+
#
|
10
|
+
# ==== Parameters
|
11
|
+
# * options<~Hash>:
|
12
|
+
# * acl<~String> - access control list, in ['private', 'public-read', 'public-read-write', 'authenticated-read', 'bucket-owner-read', 'bucket-owner-full-control']
|
13
|
+
# * Cache-Control - same as REST header
|
14
|
+
# * Content-Type - same as REST header
|
15
|
+
# * Content-Disposition - same as REST header
|
16
|
+
# * Content-Encoding - same as REST header
|
17
|
+
# * Expires - same as REST header
|
18
|
+
# * key - key for object, set to '${filename}' to use filename provided by user
|
19
|
+
# * policy - security policy for upload
|
20
|
+
# * success_action_redirect - url to redirct to upon success
|
21
|
+
# * success_action_status - status code to return on success, in [200, 201, 204]
|
22
|
+
# * x-amz-security-token - devpay security token
|
23
|
+
# * x-amz-meta-... - meta data tags
|
24
|
+
#
|
25
|
+
# See also: http://docs.amazonwebservices.com/AmazonS3/latest/dev/HTTPPOSTForms.html
|
26
|
+
#
|
27
|
+
def post_object_hidden_fields(options = {})
|
28
|
+
if options['policy']
|
29
|
+
options['policy'] = options['policy'].to_json
|
30
|
+
options['AWSAccessKeyId'] = @aws_access_key_id
|
31
|
+
string_to_sign = Base64.encode64(options['policy']).chomp!
|
32
|
+
signed_string = @hmac.sign(string_to_sign)
|
33
|
+
options['Signature'] = Base64.encode64(signed_string).chomp!
|
34
|
+
end
|
35
|
+
options
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
class Mock
|
41
|
+
|
42
|
+
def post_object_hidden_fields(options = {})
|
43
|
+
Fog::Mock.not_implemented
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/fog/aws/storage.rb
CHANGED
@@ -51,19 +51,21 @@ module Fog
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def private_key_path
|
54
|
-
|
54
|
+
@private_key_path ||= Fog.credentials[:private_key_path]
|
55
|
+
@private_key_path &&= File.expand_path(@private_key_path)
|
55
56
|
end
|
56
57
|
|
57
58
|
def private_key
|
58
|
-
@private_key ||= File.read(private_key_path)
|
59
|
+
@private_key ||= private_key_path && File.read(private_key_path)
|
59
60
|
end
|
60
61
|
|
61
62
|
def public_key_path
|
62
|
-
|
63
|
+
@public_key_path ||= Fog.credentials[:public_key_path]
|
64
|
+
@public_key_path &&= File.expand_path(@public_key_path)
|
63
65
|
end
|
64
66
|
|
65
67
|
def public_key
|
66
|
-
@public_key ||= File.read(public_key_path)
|
68
|
+
@public_key ||= public_key_path && File.read(public_key_path)
|
67
69
|
end
|
68
70
|
|
69
71
|
def ready?
|
data/lib/fog/core/collection.rb
CHANGED
data/lib/fog/core/credentials.rb
CHANGED
@@ -48,19 +48,21 @@ module Fog
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def private_key_path
|
51
|
-
|
51
|
+
@private_key_path ||= Fog.credentials[:private_key_path]
|
52
|
+
@private_key_path &&= File.expand_path(@private_key_path)
|
52
53
|
end
|
53
54
|
|
54
55
|
def private_key
|
55
|
-
@private_key ||= File.read(private_key_path)
|
56
|
+
@private_key ||= private_key_path && File.read(private_key_path)
|
56
57
|
end
|
57
58
|
|
58
59
|
def public_key_path
|
59
|
-
|
60
|
+
@public_key_path ||= Fog.credentials[:public_key_path]
|
61
|
+
@public_key_path &&= File.expand_path(@public_key_path)
|
60
62
|
end
|
61
63
|
|
62
64
|
def public_key
|
63
|
-
@public_key ||= File.read(public_key_path)
|
65
|
+
@public_key ||= public_key_path && File.read(public_key_path)
|
64
66
|
end
|
65
67
|
|
66
68
|
def ready?
|
@@ -44,19 +44,21 @@ module Fog
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def private_key_path
|
47
|
-
|
47
|
+
@private_key_path ||= Fog.credentials[:private_key_path]
|
48
|
+
@private_key_path &&= File.expand_path(@private_key_path)
|
48
49
|
end
|
49
50
|
|
50
51
|
def private_key
|
51
|
-
@private_key ||= File.read(private_key_path)
|
52
|
+
@private_key ||= private_key_path && File.read(private_key_path)
|
52
53
|
end
|
53
54
|
|
54
55
|
def public_key_path
|
55
|
-
|
56
|
+
@public_key_path ||= Fog.credentials[:public_key_path]
|
57
|
+
@public_key_path &&= File.expand_path(@public_key_path)
|
56
58
|
end
|
57
59
|
|
58
60
|
def public_key
|
59
|
-
@public_key ||= File.read(public_key_path)
|
61
|
+
@public_key ||= public_key_path && File.read(public_key_path)
|
60
62
|
end
|
61
63
|
|
62
64
|
def ready?
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 10
|
9
|
+
version: 0.3.10
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- geemus (Wesley Beary)
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-20 00:00:00 -07:00
|
18
18
|
default_executable: fog
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -329,6 +329,7 @@ files:
|
|
329
329
|
- lib/fog/aws/requests/storage/get_request_payment.rb
|
330
330
|
- lib/fog/aws/requests/storage/get_service.rb
|
331
331
|
- lib/fog/aws/requests/storage/head_object.rb
|
332
|
+
- lib/fog/aws/requests/storage/post_object_hidden_fields.rb
|
332
333
|
- lib/fog/aws/requests/storage/put_bucket.rb
|
333
334
|
- lib/fog/aws/requests/storage/put_bucket_acl.rb
|
334
335
|
- lib/fog/aws/requests/storage/put_bucket_logging.rb
|