aws_csshx 0.1.3 → 0.1.4
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.
- data/Changelog.md +5 -0
- data/TODO.md +1 -1
- data/lib/aws_csshx/application.rb +26 -7
- data/lib/aws_csshx/options.rb +2 -0
- data/lib/aws_csshx/version.rb +1 -1
- metadata +2 -2
data/Changelog.md
CHANGED
data/TODO.md
CHANGED
@@ -6,6 +6,7 @@ module AwsCsshx
|
|
6
6
|
|
7
7
|
def csshx_exists?
|
8
8
|
`which csshx > /dev/null 2>&1`
|
9
|
+
$?.success?
|
9
10
|
end
|
10
11
|
|
11
12
|
def aws_settings_exist?
|
@@ -20,7 +21,7 @@ module AwsCsshx
|
|
20
21
|
@options = {}
|
21
22
|
|
22
23
|
# No need to go further unless csshX exists
|
23
|
-
|
24
|
+
raise OptionsError, "csshX file is required" unless csshx_exists?
|
24
25
|
|
25
26
|
begin
|
26
27
|
# First we load the config file and then process the command line
|
@@ -61,9 +62,10 @@ module AwsCsshx
|
|
61
62
|
end
|
62
63
|
|
63
64
|
# Stop here without all our AWS settings
|
64
|
-
|
65
|
+
raise OptionsError, "Invalid AWS settings" unless aws_settings_exist?
|
66
|
+
|
67
|
+
raise OptionsError, "Cannot continue without AWS security group (-g)" unless @options[:group]
|
65
68
|
|
66
|
-
abort("Cannot continue without AWS security group (-g)") unless @options[:group]
|
67
69
|
@server_list = aws_server_list_by_group @options[:group]
|
68
70
|
aws_server_count = @server_list.count
|
69
71
|
|
@@ -71,21 +73,38 @@ module AwsCsshx
|
|
71
73
|
add_servers_from_command_line if @options[:additional_servers]
|
72
74
|
|
73
75
|
if has_servers? @server_list
|
74
|
-
|
76
|
+
csshx_switches = create_csshx_switches
|
77
|
+
`csshx #{[csshx_switches, @server_list].join(' ')}`
|
75
78
|
puts "Opened connections to #{aws_server_count} servers in the '#{@options[:group]}' security group."
|
76
79
|
puts "Opened connections to #{@options[:additional_servers].count} servers from command-line options." if @options[:additional_servers]
|
77
80
|
else
|
78
|
-
|
81
|
+
raise OptionsError, "No servers found in '#{@options[:group]}' group...bailing out!"
|
79
82
|
end
|
83
|
+
|
84
|
+
rescue OptionsError => e
|
85
|
+
puts "Error: #{e}"
|
86
|
+
|
80
87
|
rescue Exception => e
|
81
|
-
puts "Error: #{e
|
82
|
-
puts "
|
88
|
+
puts "#{e.class} Error: #{e}"
|
89
|
+
puts "Backtrace:\n#{e.backtrace.join("\n")}"
|
83
90
|
end
|
84
91
|
|
85
92
|
# Exit cleanly
|
86
93
|
return 0
|
87
94
|
end
|
88
95
|
|
96
|
+
def create_csshx_switches
|
97
|
+
switches = []
|
98
|
+
|
99
|
+
# Set the basics by default
|
100
|
+
switches.push('--login', @options[:login])
|
101
|
+
switches.push("--ssh_args='-i #{@options[:ec2_private_key]}'")
|
102
|
+
|
103
|
+
# Add the additional stuff specific to csshx
|
104
|
+
switches.push('--iterm2', @options[:iterm2]) if @options[:iterm2]
|
105
|
+
switches.push(@options[:csshx_opts]) if @options[:csshx_opts]
|
106
|
+
end
|
107
|
+
|
89
108
|
def add_servers_from_command_line
|
90
109
|
@server_list.push(@options[:additional_servers]).flatten!.uniq! if @options[:additional_servers]
|
91
110
|
end
|
data/lib/aws_csshx/options.rb
CHANGED
data/lib/aws_csshx/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws_csshx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-05-
|
13
|
+
date: 2012-05-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: right_aws
|