owssh 0.0.22 → 0.0.23
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.
- checksums.yaml +4 -4
- data/lib/owssh.rb +8 -5
- 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: 89e29716edeb3b2a79485f179a8cb20b47ad55dd
|
4
|
+
data.tar.gz: c804fca44ae34a035bf0cd4ca7ffdcee96f772f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e10bc353e45f2459bc6a44831acceac5dc0a9b03a533ec8b0f8a0917d8fce2db1a6713d1162481770e3d6a58c0dc8e201102adeb1e7d3e96f921de9f13682e0
|
7
|
+
data.tar.gz: f2d4ac0f1d5d2e3a775a47ec39354a3c60a335e9fc1da3389f7e8e8d6303b64780dfa6a2919410349cc607e37bff4f94a42c10d35a15683686f6d7cfa27ed363
|
data/lib/owssh.rb
CHANGED
@@ -25,15 +25,16 @@ class Owssh
|
|
25
25
|
my_instances = {}
|
26
26
|
instances_json = JSON.parse(`AWS_CONFIG_FILE=#{$aws_config_file} aws --profile #{$aws_profile} opsworks describe-instances --stack-id #{id}`)
|
27
27
|
instances_json['Instances'].each do |instance|
|
28
|
-
pub_ip = instance['ElasticIp'] || instance['PublicIp'] || "
|
28
|
+
pub_ip = instance['ElasticIp'] || instance['PublicIp'] || "N/A"
|
29
29
|
priv_ip = instance['PrivateIp'] || "N/A"
|
30
|
+
status = instance['Status']
|
30
31
|
match = instance['Hostname'].match(/(.*)\d+/) rescue nil
|
31
32
|
if !match.nil? then
|
32
33
|
type = match[1].to_s
|
33
34
|
else
|
34
35
|
type = "N/A"
|
35
36
|
end
|
36
|
-
my_instances[instance['Hostname'].to_s] = { "PUB_IP" => pub_ip.to_s, "PRIV_IP" => priv_ip.to_s, "TYPE" => type }
|
37
|
+
my_instances[instance['Hostname'].to_s] = { "PUB_IP" => pub_ip.to_s, "PRIV_IP" => priv_ip.to_s, "TYPE" => type, "STATUS" => status }
|
37
38
|
end
|
38
39
|
my_instances
|
39
40
|
end
|
@@ -45,6 +46,7 @@ class Owssh
|
|
45
46
|
column('Public IP', :width => 15, :align => 'right')
|
46
47
|
column('Private IP', :width => 15, :align => 'right')
|
47
48
|
column('Type', :width => 16)
|
49
|
+
column('Status', :width => 8)
|
48
50
|
end
|
49
51
|
instances.each do |instance_name, data|
|
50
52
|
row do
|
@@ -52,6 +54,7 @@ class Owssh
|
|
52
54
|
column(data['PUB_IP'])
|
53
55
|
column(data['PRIV_IP'])
|
54
56
|
column(data['TYPE'])
|
57
|
+
column(data['STATUS'])
|
55
58
|
end
|
56
59
|
end
|
57
60
|
end
|
@@ -155,13 +158,13 @@ class Owssh
|
|
155
158
|
# SSH to first instance of certain type
|
156
159
|
$first_instance = ""
|
157
160
|
$instances.each do |instance_name, data|
|
158
|
-
unless (instance_name =~ /#{ARGV[1].to_s}(.*)/).nil? || data["
|
161
|
+
unless (instance_name =~ /#{ARGV[1].to_s}(.*)/).nil? || data["STATUS"] == ( "stopped" || "pending" || "requested" || "pending" )
|
159
162
|
$first_instance = instance_name
|
160
163
|
break
|
161
164
|
end
|
162
165
|
end
|
163
166
|
if $first_instance == "" then
|
164
|
-
puts "Could not find host with name or type of '#{ARGV[1]}'"
|
167
|
+
puts "Could not find valid host with name or type of '#{ARGV[1]}'"
|
165
168
|
exit
|
166
169
|
else
|
167
170
|
if ARGV[2].nil? then
|
@@ -174,7 +177,7 @@ class Owssh
|
|
174
177
|
end
|
175
178
|
else
|
176
179
|
puts "I don't quite understand what you're asking me to do..."
|
177
|
-
puts " Try running owssh
|
180
|
+
puts " Try running 'owssh help' for help!"
|
178
181
|
exit
|
179
182
|
end
|
180
183
|
end
|