owssh 0.0.5 → 0.0.6
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 +19 -1
- 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: 14a2d860d3a2648cec43c800594c5c5d5013dd90
|
4
|
+
data.tar.gz: 5d80f0cb09a39460e001cf76b3f6e278a9273de6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d55539670799752744f78aabc641ff8b9cd6d9325f50c5dd9914215e66161553bbe73d9d93b9ef9d717e3c2835cd7563296b8e412dccb817bb14445e4bc75937
|
7
|
+
data.tar.gz: 5733a0b9ab0072a482442860299c0bc69d6a02f7e1ba8d6e2d5ad6803504e98a4b780d6ca605bfaeddfc8c7040c24034297c2dd482b03882594d71e3692624a3
|
data/lib/owssh.rb
CHANGED
@@ -110,6 +110,7 @@ class Owssh
|
|
110
110
|
exit
|
111
111
|
end
|
112
112
|
elsif $stacks.has_key?(ARGV[0].downcase.to_s) then
|
113
|
+
# SSH to the host
|
113
114
|
if ARGV[1].nil? then
|
114
115
|
puts "Please enter an instance name. I.E. rails-app3"
|
115
116
|
exit
|
@@ -120,12 +121,29 @@ class Owssh
|
|
120
121
|
$instances["#{instance["Hostname"]}"] = instance["PublicIp"]
|
121
122
|
end
|
122
123
|
if $instances.has_key?(ARGV[1]) then
|
124
|
+
# Open interactive SSH connnection
|
123
125
|
if ARGV[2].nil? then
|
124
126
|
puts "Opening connection to #{ARGV[1]}..."
|
125
127
|
exec("ssh -i ~/.ssh/id_rsa_dev ubuntu@#{$instances[ARGV[1].to_s]}")
|
126
|
-
|
128
|
+
elsif ARGV[3].nil? then
|
129
|
+
# Run command through SSH on host
|
127
130
|
puts "Running comand #{ARGV[2]} on host #{ARGV[1]}..."
|
128
131
|
exec("ssh -i ~/.ssh/id_rsa_dev ubuntu@#{$instances[ARGV[1].to_s]} '#{ARGV[2]}'")
|
132
|
+
else
|
133
|
+
$first_instance = ""
|
134
|
+
$instances.each do |instance_name, data|
|
135
|
+
unless (instance_name =~ /#{ARGV[1].to_s}(.*)/).nil?
|
136
|
+
$first_instance = instance_name
|
137
|
+
break
|
138
|
+
end
|
139
|
+
end
|
140
|
+
if $first_instance == "" then
|
141
|
+
puts "Could not find suitable host of type #{ARGV[1]}"
|
142
|
+
exit
|
143
|
+
else
|
144
|
+
puts "Running comand #{ARGV[2]} on first host of type #{ARGV[1]} which is #{$first_instance}..."
|
145
|
+
exec("ssh -i ~/.ssh/id_rsa_dev ubuntu@#{$first_instance.to_s} '#{ARGV[2]}'")
|
146
|
+
end
|
129
147
|
end
|
130
148
|
else
|
131
149
|
puts "Instance with name '#{ARGV[1]}' not found"
|