phpfog-fog 0.4.1.1 → 0.4.1.2
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/fog.gemspec
CHANGED
@@ -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 = 'phpfog-fog'
|
10
|
-
s.version = '0.4.1.
|
10
|
+
s.version = '0.4.1.2'
|
11
11
|
s.date = '2011-01-21'
|
12
12
|
s.rubyforge_project = 'fog'
|
13
13
|
|
@@ -24,13 +24,13 @@ module Fog
|
|
24
24
|
|
25
25
|
def destroy
|
26
26
|
requires :id
|
27
|
-
connection.
|
27
|
+
connection.grid_server_delete(id)
|
28
28
|
true
|
29
29
|
end
|
30
30
|
|
31
31
|
def image
|
32
32
|
requires :image_id
|
33
|
-
connection.grid_image_get(image_id)
|
33
|
+
connection.grid_image_get(:image => image_id)
|
34
34
|
end
|
35
35
|
|
36
36
|
def ready?
|
@@ -40,14 +40,50 @@ module Fog
|
|
40
40
|
def save
|
41
41
|
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
|
42
42
|
requires :name, :image_id, :ip, :memory
|
43
|
-
options
|
44
|
-
|
45
|
-
|
43
|
+
options = {
|
44
|
+
'isSandbox' => sandbox,
|
45
|
+
'server.ram' => memory,
|
46
|
+
'image' => image_id
|
47
|
+
}
|
48
|
+
options = options.reject {|key, value| value.nil?}
|
46
49
|
data = connection.grid_server_add(name, image, ip, options)
|
50
|
+
puts data.body.inspect
|
47
51
|
merge_attributes(data.body)
|
48
52
|
true
|
49
53
|
end
|
50
54
|
|
55
|
+
def ssh(commands)
|
56
|
+
requires :ip, :identity, :username
|
57
|
+
|
58
|
+
options = {}
|
59
|
+
options[:key_data] = [private_key] if private_key
|
60
|
+
Fog::SSH.new(ip['ip'], username, options).run(commands)
|
61
|
+
end
|
62
|
+
|
63
|
+
def setup(credentials = {})
|
64
|
+
requires :ip, :identity, :public_key, :username
|
65
|
+
Fog::SSH.new(ip['ip'], username, credentials).run([
|
66
|
+
%{mkdir .ssh},
|
67
|
+
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
68
|
+
%{passwd -l root},
|
69
|
+
%{echo "#{attributes.to_json}" >> ~/attributes.json},
|
70
|
+
%{echo "#{metadata.to_json}" >> ~/metadata.json}
|
71
|
+
])
|
72
|
+
rescue Errno::ECONNREFUSED
|
73
|
+
sleep(1)
|
74
|
+
retry
|
75
|
+
end
|
76
|
+
|
77
|
+
def username
|
78
|
+
@username ||= 'root'
|
79
|
+
end
|
80
|
+
|
81
|
+
private
|
82
|
+
|
83
|
+
def adminPass=(new_admin_pass)
|
84
|
+
@password = new_admin_pass
|
85
|
+
end
|
86
|
+
|
51
87
|
end
|
52
88
|
|
53
89
|
end
|
@@ -6,11 +6,11 @@ module Fog
|
|
6
6
|
# Create a new server
|
7
7
|
#
|
8
8
|
# ==== Parameters
|
9
|
+
# * 'name'<~String> - name of the server, 20 or fewer characters
|
9
10
|
# * 'image'<~String> - image to use, in grid_image_list
|
10
11
|
# * 'ip'<~String> - initial public ip for this server
|
11
|
-
# * 'name'<~String> - name of the server, 20 or fewer characters
|
12
|
-
# * 'server_ram'<~String> - flavor to use, in common_lookup_list('server.ram')
|
13
12
|
# * 'options'<~Hash>:
|
13
|
+
# * 'server.ram'<~String> - flavor to use, in common_lookup_list('server.ram')
|
14
14
|
# * 'description'<~String> - description of this server
|
15
15
|
# * 'isSandbox'<~String> - treat this server as image sandbox? in ['true', 'false']
|
16
16
|
#
|
@@ -18,14 +18,13 @@ module Fog
|
|
18
18
|
# * response<~Excon::Response>:
|
19
19
|
# * body<~Array>:
|
20
20
|
# TODO: docs
|
21
|
-
def grid_server_add(image, ip,
|
21
|
+
def grid_server_add(name, image, ip, options={})
|
22
22
|
request(
|
23
23
|
:path => 'grid/server/add',
|
24
24
|
:query => {
|
25
25
|
'image' => image,
|
26
26
|
'ip' => ip,
|
27
27
|
'name' => name,
|
28
|
-
'server.ram' => server_ram
|
29
28
|
}.merge!(options)
|
30
29
|
)
|
31
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phpfog-fog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 111
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
9
|
- 1
|
10
|
-
-
|
11
|
-
version: 0.4.1.
|
10
|
+
- 2
|
11
|
+
version: 0.4.1.2
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- geemus (Wesley Beary)
|