kytoon 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/VERSION +1 -1
- data/lib/kytoon/providers/cloud_cue/server_group.rb +9 -13
- data/lib/kytoon/server_group.rb +3 -2
- data/lib/kytoon/thor_tasks.rb +20 -10
- metadata +2 -2
data/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
* Tue Aug 20 2013 Dan Prince <dprince@redhat.com> - 1.4.2
|
2
|
+
-Add --remote option to be used when listing remote CloudCue
|
3
|
+
groups.
|
4
|
+
|
1
5
|
* Tue Aug 20 2013 Dan Prince <dprince@redhat.com> - 1.4.1
|
2
6
|
-Add ability to list remote groups with CloudCue provider.
|
3
7
|
-Test fixes for CloudCue.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.2
|
@@ -238,7 +238,7 @@ class ServerGroup
|
|
238
238
|
until online or (count*20) >= timeout.to_i do
|
239
239
|
count+=1
|
240
240
|
begin
|
241
|
-
sg=ServerGroup.get(:id => @id, :
|
241
|
+
sg=ServerGroup.get(:id => @id, :remote => true)
|
242
242
|
|
243
243
|
online=true
|
244
244
|
sg.servers.each do |server|
|
@@ -279,7 +279,7 @@ class ServerGroup
|
|
279
279
|
server_group.pretty_print
|
280
280
|
end
|
281
281
|
end
|
282
|
-
sg=ServerGroup.get(:id => sg.id, :
|
282
|
+
sg=ServerGroup.get(:id => sg.id, :remote => true)
|
283
283
|
sg.cache_to_disk
|
284
284
|
puts "Server group online."
|
285
285
|
sg
|
@@ -289,11 +289,10 @@ class ServerGroup
|
|
289
289
|
# Get a server group. The following options are available:
|
290
290
|
#
|
291
291
|
# :id - The ID of the server group to get. Defaults to ENV['GROUP_ID']
|
292
|
-
# :
|
292
|
+
# :remote - true or false
|
293
293
|
def self.get(options={})
|
294
294
|
|
295
|
-
|
296
|
-
source = 'cache' if source.nil? or source.empty?
|
295
|
+
remote = options[:remote] or false
|
297
296
|
id = options[:id]
|
298
297
|
if id.nil? then
|
299
298
|
group = ServerGroup.most_recent
|
@@ -301,27 +300,24 @@ class ServerGroup
|
|
301
300
|
id = group.id
|
302
301
|
end
|
303
302
|
|
304
|
-
if
|
303
|
+
if remote then
|
305
304
|
xml=Connection.get("/server_groups/#{id}.xml")
|
306
305
|
ServerGroup.from_xml(xml)
|
307
|
-
|
306
|
+
else
|
308
307
|
out_file = File.join(@@data_dir, "#{id}.xml")
|
309
308
|
raise "No server group files exist." if not File.exists?(out_file)
|
310
309
|
ServerGroup.from_xml(IO.read(out_file))
|
311
|
-
else
|
312
|
-
raise "Invalid get :source specified."
|
313
310
|
end
|
314
311
|
|
315
312
|
end
|
316
313
|
|
317
|
-
# :
|
314
|
+
# :remote - true or false
|
318
315
|
def self.index(options={})
|
319
316
|
|
320
|
-
|
321
|
-
source = 'cache' if source.nil? or source.empty?
|
317
|
+
remote = options[:remote] or false
|
322
318
|
server_groups=[]
|
323
319
|
|
324
|
-
if
|
320
|
+
if remote then
|
325
321
|
xml=Connection.get("/server_groups.xml")
|
326
322
|
dom = REXML::Document.new(xml)
|
327
323
|
REXML::XPath.each(dom, "//server-group") do |group_xml|
|
data/lib/kytoon/server_group.rb
CHANGED
data/lib/kytoon/thor_tasks.rb
CHANGED
@@ -23,10 +23,11 @@ class ThorTasks < Thor
|
|
23
23
|
|
24
24
|
desc "list", "List existing server groups."
|
25
25
|
method_options :group_type => :string
|
26
|
+
method_options :remote => :boolean, :default => false
|
26
27
|
def list(options=(options or {}))
|
27
28
|
begin
|
28
29
|
ServerGroup.init(options[:group_type])
|
29
|
-
ServerGroup.index()
|
30
|
+
ServerGroup.index({:remote => options[:remote]})
|
30
31
|
rescue KytoonException => ke
|
31
32
|
puts ke.message
|
32
33
|
exit 1
|
@@ -36,10 +37,11 @@ class ThorTasks < Thor
|
|
36
37
|
desc "show", "Print information for a server group."
|
37
38
|
method_options :group_id => :string
|
38
39
|
method_options :group_type => :string
|
40
|
+
method_options :remote => :boolean, :default => false
|
39
41
|
def show(options=(options or {}))
|
40
42
|
begin
|
41
43
|
ServerGroup.init(options[:group_type])
|
42
|
-
sg = ServerGroup.get(options[:group_id])
|
44
|
+
sg = ServerGroup.get(options[:group_id], {:remote => options[:remote]})
|
43
45
|
sg.pretty_print
|
44
46
|
rescue KytoonException => ke
|
45
47
|
puts ke.message
|
@@ -50,10 +52,11 @@ class ThorTasks < Thor
|
|
50
52
|
desc "delete", "Delete a server group."
|
51
53
|
method_options :group_id => :string
|
52
54
|
method_options :group_type => :string
|
55
|
+
method_options :remote => :boolean, :default => false
|
53
56
|
def delete(options=(options or {}))
|
54
57
|
begin
|
55
58
|
ServerGroup.init(options[:group_type])
|
56
|
-
sg = ServerGroup.get(options[:group_id])
|
59
|
+
sg = ServerGroup.get(options[:group_id], {:remote => options[:remote]})
|
57
60
|
sg.delete
|
58
61
|
SshUtil.remove_known_hosts_ip(sg.gateway_ip)
|
59
62
|
rescue KytoonException => ke
|
@@ -65,10 +68,11 @@ class ThorTasks < Thor
|
|
65
68
|
desc "ip", "Print the IP address of the gateway server"
|
66
69
|
method_options :group_id => :string
|
67
70
|
method_options :group_type => :string
|
71
|
+
method_options :remote => :boolean, :default => false
|
68
72
|
def ip(options=(options or {}))
|
69
73
|
begin
|
70
74
|
ServerGroup.init(options[:group_type])
|
71
|
-
sg = ServerGroup.get(options[:group_id])
|
75
|
+
sg = ServerGroup.get(options[:group_id], {:remote => options[:remote]})
|
72
76
|
puts sg.gateway_ip
|
73
77
|
rescue KytoonException => ke
|
74
78
|
puts ke.message
|
@@ -79,16 +83,22 @@ class ThorTasks < Thor
|
|
79
83
|
desc "ssh", "SSH into a group."
|
80
84
|
method_options :group_id => :string
|
81
85
|
method_options :group_type => :string
|
86
|
+
method_options :remote => :boolean, :default => false
|
82
87
|
def ssh(*)
|
83
88
|
begin
|
84
89
|
ServerGroup.init(options[:group_type])
|
85
90
|
args=ARGV[1, ARGV.length].join(" ")
|
86
|
-
sg = ServerGroup.get(options[:group_id])
|
87
|
-
if (ARGV[1] and ARGV[1] =~ /^--group_id.*/) and (ARGV[2] and ARGV[2] =~ /^--group_id.*/)
|
88
|
-
args=ARGV[3, ARGV.length].join(" ")
|
89
|
-
elsif ARGV[1] and ARGV[1] =~ /^--group_id.*/
|
90
|
-
args=ARGV[2, ARGV.length].join(" ")
|
91
|
-
end
|
91
|
+
sg = ServerGroup.get(options[:group_id], {:remote => options[:remote]})
|
92
|
+
#if (ARGV[1] and ARGV[1] =~ /^--group_id.*/) and (ARGV[2] and ARGV[2] =~ /^--group_id.*/)
|
93
|
+
#args=ARGV[3, ARGV.length].join(" ")
|
94
|
+
#elsif ARGV[1] and ARGV[1] =~ /^--group_id.*/
|
95
|
+
#args=ARGV[2, ARGV.length].join(" ")
|
96
|
+
#end
|
97
|
+
arg_count = 1
|
98
|
+
arg_count +=1 if args =~ /--group_type/
|
99
|
+
arg_count +=1 if args =~ /--group_id/
|
100
|
+
arg_count +=1 if args =~ /--remote/
|
101
|
+
args=ARGV[arg_count, ARGV.length].join(" ")
|
92
102
|
exec("ssh -o \"StrictHostKeyChecking no\" root@#{sg.gateway_ip} #{args}")
|
93
103
|
rescue KytoonException => ke
|
94
104
|
puts ke.message
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kytoon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -283,7 +283,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
283
283
|
version: '0'
|
284
284
|
segments:
|
285
285
|
- 0
|
286
|
-
hash:
|
286
|
+
hash: 1893588902202544719
|
287
287
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
288
288
|
none: false
|
289
289
|
requirements:
|