fog 0.0.99 → 0.0.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +6 -0
- data/bin/fog +8 -8
- data/fog.gemspec +2 -2
- data/lib/fog.rb +1 -1
- data/lib/fog/aws.rb +5 -2
- data/lib/fog/aws/models/ec2/server.rb +12 -22
- data/lib/fog/aws/requests/ec2/describe_instances.rb +3 -2
- data/lib/fog/aws/requests/ec2/run_instances.rb +17 -6
- data/lib/fog/terremark/models/shared/server.rb +2 -0
- data/lib/fog/terremark/models/shared/task.rb +7 -0
- data/lib/fog/terremark/models/shared/vdc.rb +4 -0
- data/lib/fog/terremark/parsers/shared/task.rb +1 -1
- data/lib/fog/vcloud.rb +1 -1
- data/lib/fog/vcloud/bin.rb +2 -2
- metadata +3 -3
data/Rakefile
CHANGED
@@ -79,6 +79,12 @@ end
|
|
79
79
|
#
|
80
80
|
#############################################################################
|
81
81
|
|
82
|
+
require 'spec/rake/spectask'
|
83
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
84
|
+
spec.libs << 'lib' << 'spec'
|
85
|
+
spec.spec_opts = ['--colour', "--format", "specdoc"]
|
86
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
87
|
+
end
|
82
88
|
|
83
89
|
|
84
90
|
#############################################################################
|
data/bin/fog
CHANGED
@@ -2,20 +2,20 @@
|
|
2
2
|
require File.join(File.dirname(__FILE__), '..', 'lib', 'fog')
|
3
3
|
require 'irb'
|
4
4
|
require 'yaml'
|
5
|
-
require 'fog
|
6
|
-
require 'fog
|
5
|
+
require File.join('fog', 'credentials')
|
6
|
+
require File.join('fog', 'bin')
|
7
7
|
|
8
8
|
Fog.credential = (ARGV.first && :"#{ARGV.first}") || :default
|
9
9
|
unless Fog.credentials
|
10
10
|
exit
|
11
11
|
end
|
12
12
|
|
13
|
-
require 'fog
|
14
|
-
require 'fog
|
15
|
-
require 'fog
|
16
|
-
require 'fog
|
17
|
-
require 'fog
|
18
|
-
require 'fog
|
13
|
+
require File.join('fog', 'aws', 'bin')
|
14
|
+
require File.join('fog', 'local', 'bin')
|
15
|
+
require File.join('fog', 'rackspace', 'bin')
|
16
|
+
require File.join('fog', 'slicehost', 'bin')
|
17
|
+
require File.join('fog', 'terremark', 'bin')
|
18
|
+
require File.join('fog', 'vcloud', 'bin')
|
19
19
|
|
20
20
|
if ARGV.length > 1
|
21
21
|
print(instance_eval(ARGV[1..-1].join(' ')).to_json)
|
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.0.
|
11
|
-
s.date = '2010-05-
|
10
|
+
s.version = '0.0.100'
|
11
|
+
s.date = '2010-05-18'
|
12
12
|
s.rubyforge_project = 'fog'
|
13
13
|
|
14
14
|
## Make sure your summary is short. The description may be as long
|
data/lib/fog.rb
CHANGED
data/lib/fog/aws.rb
CHANGED
@@ -6,10 +6,13 @@ require 'fog/aws/simpledb'
|
|
6
6
|
module Fog
|
7
7
|
module AWS
|
8
8
|
|
9
|
-
def self.indexed_param(key, values)
|
9
|
+
def self.indexed_param(key, values, offset = 0)
|
10
10
|
params = {}
|
11
|
+
unless key.include?('%d')
|
12
|
+
key << '.%d'
|
13
|
+
end
|
11
14
|
[*values].each_with_index do |value, index|
|
12
|
-
params[
|
15
|
+
params[format(key, index + offset)] = value
|
13
16
|
end
|
14
17
|
params
|
15
18
|
end
|
@@ -115,28 +115,18 @@ module Fog
|
|
115
115
|
def save
|
116
116
|
requires :image_id
|
117
117
|
|
118
|
-
options = {
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
end
|
131
|
-
if @monitoring
|
132
|
-
options['Monitoring.Enabled'] = @monitoring
|
133
|
-
end
|
134
|
-
if @ramdisk_id
|
135
|
-
options['RamdiskId'] = @ramdisk_id
|
136
|
-
end
|
137
|
-
if @user_data
|
138
|
-
options['UserData'] = @user_data
|
139
|
-
end
|
118
|
+
options = {
|
119
|
+
'BlockDeviceMapping' => @block_device_mapping,
|
120
|
+
'InstanceType' => flavor.id,
|
121
|
+
'KernelId' => @kernel_id,
|
122
|
+
'KeyName' => @key_name,
|
123
|
+
'Monitoring.Enabled' => @monitoring,
|
124
|
+
'Placement.AvailabilityZone' => @availability_zone,
|
125
|
+
'RamdiskId' => @ramdisk_id,
|
126
|
+
'SecurityGroup' => @groups,
|
127
|
+
'UserData' => @user_data
|
128
|
+
}
|
129
|
+
|
140
130
|
data = connection.run_instances(@image_id, 1, 1, options)
|
141
131
|
merge_attributes(data.body['instancesSet'].first)
|
142
132
|
true
|
@@ -51,8 +51,9 @@ module Fog
|
|
51
51
|
def describe_instances(instance_id = [])
|
52
52
|
params = AWS.indexed_param('InstanceId', instance_id)
|
53
53
|
request({
|
54
|
-
'Action'
|
55
|
-
:
|
54
|
+
'Action' => 'DescribeInstances',
|
55
|
+
:idempotent => true,
|
56
|
+
:parser => Fog::Parsers::AWS::EC2::DescribeInstances.new
|
56
57
|
}.merge!(params))
|
57
58
|
end
|
58
59
|
|
@@ -18,12 +18,13 @@ module Fog
|
|
18
18
|
# (by default the maximum for an account is 20)
|
19
19
|
# * options<~Hash>:
|
20
20
|
# * 'Placement.AvailabilityZone'<~String> - Placement constraint for instances
|
21
|
-
# * 'BlockDeviceMapping
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
21
|
+
# * 'BlockDeviceMapping'<~Array>: array of hashes
|
22
|
+
# * 'DeviceName'<~String> - where the volume will be exposed to instance
|
23
|
+
# * 'VirtualName'<~String> - volume virtual device name
|
24
|
+
# * 'Ebs.SnapshotId'<~String> - id of snapshot to boot volume from
|
25
|
+
# * 'Ebs.VolumeSize'<~String> - size of volume in GiBs required unless snapshot is specified
|
26
|
+
# * 'Ebs.DeleteOnTermination'<~String> - specifies whether or not to delete the volume on instance termination
|
27
|
+
# * 'SecurityGroup'<~Array> or <~String> - Name of security group(s) for instances
|
27
28
|
# * 'InstanceInitiatedShutdownBehaviour'<~String> - specifies whether volumes are stopped or terminated when instance is shutdown
|
28
29
|
# * 'InstanceType'<~String> - Type of instance to boot. Valid options
|
29
30
|
# in ['m1.small', 'm1.large', 'm1.xlarge', 'c1.medium', 'c1.xlarge', 'm2.2xlarge', 'm2.4xlarge']
|
@@ -76,6 +77,16 @@ module Fog
|
|
76
77
|
# * 'requestId'<~String> - Id of request
|
77
78
|
# * 'reservationId'<~String> - Id of reservation
|
78
79
|
def run_instances(image_id, min_count, max_count, options = {})
|
80
|
+
if block_device_mapping = options.delete('BlockDeviceMapping')
|
81
|
+
block_device_mapping.each_with_index do |mapping, index|
|
82
|
+
for key, value in mapping
|
83
|
+
options.merge!({ format("BlockDeviceMapping.%d.#{key}", index) => value })
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
if security_groups = [*options.delete('SecurityGroup')]
|
88
|
+
options.merge!(AWS.indexed_param('SecurityGroup', security_groups))
|
89
|
+
end
|
79
90
|
if options['UserData']
|
80
91
|
options['UserData'] = Base64.encode64(options['UserData'])
|
81
92
|
end
|
@@ -13,15 +13,22 @@ module Fog
|
|
13
13
|
attribute :result, 'Result'
|
14
14
|
attribute :start_time, 'startTime'
|
15
15
|
attribute :status
|
16
|
+
attribute :link, 'Link'
|
17
|
+
attribute :error, 'Error'
|
16
18
|
|
17
19
|
def initialize(attributes = {})
|
18
20
|
new_owner = attributes.delete('Owner')
|
19
21
|
new_result = attributes.delete('Result')
|
22
|
+
new_error = attributes.delete('Error')
|
23
|
+
new_cancel_link = attributes.delete('Link')
|
24
|
+
|
20
25
|
super
|
21
26
|
@owner = connection.parse(new_owner)
|
22
27
|
if new_result
|
23
28
|
@result = connection.parse(new_result)
|
24
29
|
end
|
30
|
+
@error = connection.parse(new_error) if new_error
|
31
|
+
@cancel_link = connection.parse(new_cancel_link) if new_cancel_link
|
25
32
|
end
|
26
33
|
|
27
34
|
def ready?
|
data/lib/fog/vcloud.rb
CHANGED
data/lib/fog/vcloud/bin.rb
CHANGED
@@ -25,14 +25,14 @@ module Vcloud
|
|
25
25
|
false
|
26
26
|
end
|
27
27
|
|
28
|
-
if Vcloud.services.all? { |service| Vcloud.complete_service_options?(service) }
|
28
|
+
if Vcloud.services.any? && Vcloud.services.all? { |service| Vcloud.complete_service_options?(service) }
|
29
29
|
|
30
30
|
def initialized?
|
31
31
|
true
|
32
32
|
end
|
33
33
|
|
34
34
|
def startup_notice
|
35
|
-
puts "You have
|
35
|
+
puts "You have access to the following vCloud services: #{Vcloud.registered_services}."
|
36
36
|
end
|
37
37
|
|
38
38
|
def [](service)
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 100
|
9
|
+
version: 0.0.100
|
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-05-
|
17
|
+
date: 2010-05-18 00:00:00 -07:00
|
18
18
|
default_executable: fog
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|