aws_csshx 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,10 @@
1
+ ### aws_csshx 0.1.3 2012-05-05
2
+
3
+ * Ability to add individual servers on the command line (Eric Lubow)
4
+
1
5
  ### aws_csshx 0.1.2 2012-05-04
2
6
 
3
- * Bug with listing servers
7
+ * Bug with listing servers (Eric Lubow)
4
8
 
5
9
  ### aws_csshx 0.1.1 2012-05-04
6
10
 
data/README.md CHANGED
@@ -9,6 +9,7 @@ This is a wrapper script for ClusterSSHX (csshx). It allows the user the abilit
9
9
  ### Configuration
10
10
 
11
11
  The easist way to configure this gem is to add the following 4 lines to your _~/.csshrc_ (replace with your values):
12
+
12
13
  aws_region = us-east-1
13
14
  aws_access_key = AAAAAAAAAAAAAAAAAAAA
14
15
  aws_secret_key = TaaaaaLNiYbbbbbJm6uuqphcccccXtZydddddDfd
@@ -21,3 +22,8 @@ The most common use/case of _aws_csshx_ is to just ssh into a security group.
21
22
  For instance, to SSH into the entire *utility* security group as *root*, do the following:
22
23
 
23
24
  aws_csshx -g 'utility' -l root
25
+
26
+ ## Authors
27
+
28
+ * Russell Bradberry <@devdazed>
29
+ * Eric Lubow <@elubow>
data/TODO.md CHANGED
@@ -1,3 +1,7 @@
1
1
  ### TODO List for aws_csshx
2
2
 
3
- * Add ability to use -H/--hosts to tack on additional hosts to the SSH cluster
3
+ * Add testing
4
+ * Specify AWS secret and access key on the command
5
+ * Better method for system call
6
+ * Silence RightAws::Ec2 output
7
+ * Add logging for verbose output
@@ -43,7 +43,7 @@ module AwsCsshx
43
43
  end
44
44
 
45
45
  # Deal with the option issues
46
- if command_line_options[:invalid_argument]
46
+ if command_line_options.parsed? and command_line_options[:invalid_argument]
47
47
  $stderr.puts command_line_options[:invalid_argument]
48
48
  @options[:help] = true
49
49
  end
@@ -65,10 +65,15 @@ module AwsCsshx
65
65
 
66
66
  abort("Cannot continue without AWS security group (-g)") unless @options[:group]
67
67
  @server_list = aws_server_list_by_group @options[:group]
68
+ aws_server_count = @server_list.count
69
+
70
+ # Add any additional servers from the command line to the pool
71
+ add_servers_from_command_line if @options[:additional_servers]
68
72
 
69
73
  if has_servers? @server_list
70
74
  `csshx --login #{@options[:login]} --ssh_args='-i #{@options[:ec2_private_key]}' #{@server_list.join(' ')}`
71
- puts "Opened connections to #{@server_list.count} servers in the '#{@options[:group]}' security group."
75
+ puts "Opened connections to #{aws_server_count} servers in the '#{@options[:group]}' security group."
76
+ puts "Opened connections to #{@options[:additional_servers].count} servers from command-line options." if @options[:additional_servers]
72
77
  else
73
78
  puts "No servers found...bailing out!"
74
79
  end
@@ -81,6 +86,10 @@ module AwsCsshx
81
86
  return 0
82
87
  end
83
88
 
89
+ def add_servers_from_command_line
90
+ @server_list.push(@options[:additional_servers]).flatten!.uniq! if @options[:additional_servers]
91
+ end
92
+
84
93
  def aws_server_list_by_group(group)
85
94
  @ec2_api ||= RightAws::Ec2.new(@options[:aws_access_key], @options[:aws_secret_key])
86
95
 
@@ -1,6 +1,6 @@
1
1
  module AwsCsshx
2
2
  class Options < Hash
3
- attr_reader :opts, :orig_args
3
+ attr_reader :opts, :orig_args, :parsed
4
4
 
5
5
  def initialize(args)
6
6
  super()
@@ -9,6 +9,7 @@ module AwsCsshx
9
9
 
10
10
  @orig_args = args.clone
11
11
 
12
+ @parsed = false
12
13
  options = {}
13
14
 
14
15
  require 'optparse'
@@ -31,6 +32,10 @@ module AwsCsshx
31
32
  options[:aws_region] = region
32
33
  end
33
34
 
35
+ o.on( '-H', '--hosts x,y,z', Array, 'Additional hosts to add to the group (comma separated)' ) do |server_list|
36
+ options[:additional_servers] = server_list
37
+ end
38
+
34
39
  o.separator ""
35
40
  o.separator "csshX Options"
36
41
 
@@ -84,6 +89,11 @@ module AwsCsshx
84
89
  @opts.parse(args, flags={ :delete_invalid_opts => true })
85
90
  self[:options] = options
86
91
  end
92
+ @parsed = true
93
+ end
94
+
95
+ def parsed?
96
+ @parsed
87
97
  end
88
98
  end
89
99
  end
@@ -1,3 +1,3 @@
1
1
  module AwsCsshx
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
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.2
4
+ version: 0.1.3
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-04 00:00:00.000000000 Z
13
+ date: 2012-05-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: right_aws