owssh 0.0.21 → 0.0.22

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/owssh.rb +11 -7
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13b08097506be739ae1141781e8c65f7dc81dddb
4
- data.tar.gz: 4213409533df11503d7f6484f136e389b0b268c1
3
+ metadata.gz: 9073124d247d3d0cc868605fdd04e38e23a4e30a
4
+ data.tar.gz: 5b265edf9b5a0a1e373e090ff82893fd0b499ac4
5
5
  SHA512:
6
- metadata.gz: e9f98b212f6f840c1c8431c611380095e51e625aec8bd9e985deee722fc555f3a3b365647098fcc5aebfbb64b3347dbb0212d9ae4134ca96efb256a4f30e97e5
7
- data.tar.gz: 832c8eea6453072da837f9e59dfe2ebf98d86aa7f31127ca2df344ae09ab67e9bc188f9320102c9ae40d7eb8c7842db8e74f8bfac19f5b7548f3c8e5140827ba
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
- stack_name = ARGV[1]
122
- if $stacks.has_key?(ARGV[1].downcase.to_s) then
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
- # Open interactive SSH connnection
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"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: owssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Hutchins