cloudkick 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/cloudkick.gemspec +1 -1
- data/lib/cloudkick/commands/parallel.rb +19 -5
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/cloudkick.gemspec
CHANGED
@@ -3,18 +3,32 @@ require 'tempfile'
|
|
3
3
|
module Cloudkick::Command
|
4
4
|
class Pssh < Base
|
5
5
|
def index
|
6
|
-
unless args.size ==
|
7
|
-
raise CommandFailed, 'usage: cloudkick pssh
|
6
|
+
unless args.size == 6 or args.size == 8
|
7
|
+
raise CommandFailed, 'usage: cloudkick pssh --query <query> ' \
|
8
|
+
'--username <username> ' \
|
9
|
+
'--output <output> ' \
|
10
|
+
'--command <command>'
|
8
11
|
end
|
9
12
|
|
13
|
+
query = extract_option('--query')
|
14
|
+
username = extract_option('--username')
|
15
|
+
output = extract_option('--output')
|
16
|
+
command = extract_option('--command')
|
17
|
+
|
10
18
|
file = Tempfile.new('ck')
|
11
19
|
|
12
|
-
|
13
|
-
|
20
|
+
if query
|
21
|
+
client.get('nodes', query).each do |node|
|
22
|
+
file.puts node.ipaddress
|
23
|
+
end
|
24
|
+
else
|
25
|
+
client.get('nodes').each do |node|
|
26
|
+
file.puts node.ipaddress
|
27
|
+
end
|
14
28
|
end
|
15
29
|
|
16
30
|
file.flush
|
17
|
-
exec("pssh -h #{file.path} -l #{
|
31
|
+
exec("pssh -h #{file.path} -l #{username} -o #{output} #{command}")
|
18
32
|
file.close
|
19
33
|
end
|
20
34
|
end
|