owssh 0.0.21 → 0.0.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/owssh.rb +11 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9073124d247d3d0cc868605fdd04e38e23a4e30a
|
4
|
+
data.tar.gz: 5b265edf9b5a0a1e373e090ff82893fd0b499ac4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e6510435b1edea2595fdf5310d42e994cdd8d5db5f00f03658615489cffba3a33346563708d4ee38d3a8192df2084fb715a9b02a4046848e68e76e30f9a6dd0
|
7
|
+
data.tar.gz: 3794121b2db1b4192f44600c500a8d54dfca94b0e7414acc0168a19c6bdafb0196f3e639178ccdd5b70a4fa8e7fb26a42953d22247f4a1884ce4e59b5036eaf0
|
data/lib/owssh.rb
CHANGED
@@ -107,10 +107,12 @@ class Owssh
|
|
107
107
|
if ARGV[0] == "help" then
|
108
108
|
print_help
|
109
109
|
elsif ARGV[0] == "list" then
|
110
|
+
# List all stacks
|
110
111
|
puts "Getting list of stacks..."
|
111
112
|
print_stacks($stacks)
|
112
113
|
exit
|
113
114
|
elsif ARGV[0] == "describe" && ARGV[1].nil? then
|
115
|
+
# Describe all stacks
|
114
116
|
$stacks.each do |stack_name, id|
|
115
117
|
puts "Getting data for Stack: #{stack_name}"
|
116
118
|
$instances = get_instances(id)
|
@@ -118,8 +120,9 @@ class Owssh
|
|
118
120
|
end
|
119
121
|
exit
|
120
122
|
elsif ARGV[0] == "describe" && !ARGV[1].nil? then
|
121
|
-
|
122
|
-
|
123
|
+
# Describe a particular stack
|
124
|
+
stack_name = ARGV[1].downcase.to_s
|
125
|
+
if $stacks.has_key?(stack_name) then
|
123
126
|
if $debug then puts "Stack ID: #{$stacks[stack_name]}" end
|
124
127
|
puts "Getting data for Stack: #{stack_name}"
|
125
128
|
$instances = get_instances($stacks[stack_name])
|
@@ -135,20 +138,21 @@ class Owssh
|
|
135
138
|
exit
|
136
139
|
end
|
137
140
|
|
138
|
-
stack_name = ARGV[0].downcase
|
141
|
+
stack_name = ARGV[0].downcase.to_s
|
139
142
|
$instances = get_instances($stacks[stack_name])
|
140
143
|
|
141
|
-
if $instances.has_key?(ARGV[1]) then
|
142
|
-
#
|
144
|
+
if $instances.has_key?(ARGV[1].downcase.to_s) then
|
145
|
+
# SSH to specific host
|
143
146
|
if ARGV[2].nil? then
|
144
147
|
puts "Opening SSH connection to #{ARGV[1]}..."
|
145
|
-
exec("ssh -i ~/.ssh/id_rsa_dev ubuntu@#{$instances[ARGV[1].to_s]['PUB_IP']}")
|
148
|
+
exec("ssh -i ~/.ssh/id_rsa_dev ubuntu@#{$instances[ARGV[1].downcase.to_s]['PUB_IP']}")
|
146
149
|
elsif ARGV[3].nil? then
|
147
150
|
# Run command through SSH on host
|
148
151
|
puts "Running comand #{ARGV[2]} on host #{ARGV[1]}..."
|
149
|
-
exec("ssh -i ~/.ssh/id_rsa_dev ubuntu@#{$instances[ARGV[1].to_s]['PUB_IP']} '#{ARGV[2]}'")
|
152
|
+
exec("ssh -i ~/.ssh/id_rsa_dev ubuntu@#{$instances[ARGV[1].downcase.to_s]['PUB_IP']} '#{ARGV[2]}'")
|
150
153
|
end
|
151
154
|
else
|
155
|
+
# SSH to first instance of certain type
|
152
156
|
$first_instance = ""
|
153
157
|
$instances.each do |instance_name, data|
|
154
158
|
unless (instance_name =~ /#{ARGV[1].to_s}(.*)/).nil? || data["PUB_IP"] == "DOWN"
|