ec2-clusterssh 0.3.0 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 83d88a4cea26fe56c682d7e9dcec4c9a10051547
4
+ data.tar.gz: db0f883685623e31a2ed911f7d4916f538c2c379
5
+ SHA512:
6
+ metadata.gz: 24679afc44231152ccb2bde8cf7b22e3ecfef0fc229eef753f9981ef61bc2eff56e5219ad1b543753a301b8df214157b1bdacb39aa90eb27aff90a627ca8279a
7
+ data.tar.gz: 3e994e22717df3fa5d66999c15b80a57e582a656dedf863f002e44b0afa3e01a03ec1a2b53ccc52da41ad498352ce391c630189ae5d42227745ef1ee9c3677d3
data/README.md CHANGED
@@ -33,12 +33,10 @@ NOTE: Some linux users have reported problems using /etc/csshrc, but have had su
33
33
  Usage: cluster [-t TAGS] [-l USER] [-k KEY -s SECRET] [-r region]
34
34
  -l, --login [USER] Log in with this user (default: ec2-user
35
35
  -t, --tags [TAGS] a 'space' sparated key value pair of tags and values (i.e. role=web,database environment=dev)
36
- -k, --access-key [KEY] AWS access key
37
- -s, --secret-key [SECRET] AWS secret key
38
36
  -r, --region [REGION] AWS region
39
37
  -p, --use-private-ip Use private IP (default false)
40
38
 
41
- $cluster -l ec2-user -t Name=web,database #Connects to all web and database servers
39
+ $cluster -l ec2-user -t Name=web,database #Connects to all web and database servers
42
40
  $cluster -l ec2-user -t role=web,database environment=dev #Connects to all web and database servers in the dev environment
43
41
 
44
42
  ## Contributing
@@ -4,7 +4,12 @@ require 'optparse'
4
4
  require 'rubygems'
5
5
  require 'aws-sdk'
6
6
 
7
- options = {'user' => 'ec2-user', 'use_private_ip' => false}
7
+ options = {
8
+ 'user' => 'ec2-user',
9
+ 'use_private_ip' => false,
10
+ 'region' => 'us-east-1'
11
+ }
12
+
8
13
  OptionParser.new do |opts|
9
14
  opts.banner = "Usage: cluster [-t TAGS] [-l USER] [-k KEY -s SECRET] [-r region]"
10
15
 
@@ -12,16 +17,8 @@ OptionParser.new do |opts|
12
17
  options['user'] = opt
13
18
  end
14
19
 
15
- opts.on("-t", "--tags [TAGS]", Array, "a 'space' sparated key value pair of tags and values (i.e. role=web,database environment=dev)") do |opt|
16
- options['tags'] = opt
17
- end
18
-
19
- opts.on("-k", "--access-key [KEY]", "AWS access key") do |opt|
20
- options['aws_access_key'] = opt
21
- end
22
-
23
- opts.on("-s", "--secret-key [SECRET]", "AWS secret key") do |opt|
24
- options['aws_secret_key'] = opt
20
+ opts.on("-t", "--tags [TAGS]", "a 'space' sparated key value pair of tags and values (i.e. role=web,database environment=dev)") do |opt|
21
+ options['tags'] = opt.split(' ')
25
22
  end
26
23
 
27
24
  opts.on("-r", "--region [REGION]", "AWS region") do |opt|
@@ -33,21 +30,17 @@ OptionParser.new do |opts|
33
30
  end
34
31
  end.parse!
35
32
 
36
- if !options['aws_secret_key'].nil? && !options['aws_access_key'].nil?
37
- AWS.config(access_key_id: options['aws_access_key'], secret_access_key: options['aws_secret_key'])
38
- end
39
-
40
- if !options['region'].nil?
41
- AWS.config(region: options['region'])
42
- end
33
+ AWS.config(:region => options['region'])
43
34
 
44
- ec2 = AWS.ec2
35
+ ec2 = AWS::EC2.new
45
36
 
46
37
  # filter instances based on tags
47
38
  instances = ec2.instances
48
39
  options['tags'].each do |tag|
49
40
  tag = tag.split('=')
50
- instances = instances.tagged(tag[0]).tagged_values(tag[1])
41
+ key = tag[0]
42
+ values = tag[1].split(',')
43
+ instances = instances.tagged(key).tagged_values(values)
51
44
  end
52
45
 
53
46
  # get dns entries for cssh
@@ -58,6 +51,14 @@ else
58
51
  dns = instances.map{|instance| instance.dns_name}
59
52
  end
60
53
 
54
+ if dns.length == 0
55
+ puts "No instances matched #{options['tags']}"
56
+ exit
57
+ end
58
+
61
59
  cssh = (/darwin/ =~ RUBY_PLATFORM) ? 'csshX' : 'cssh'
62
60
 
63
- exec "#{cssh} -l #{options['user']} #{dns.join ' '}"
61
+ cmd = "#{cssh} -l #{options['user']} #{dns.join ' '}"
62
+ puts "Connecting to #{dns.length} instances"
63
+ puts cmd
64
+ exec cmd
@@ -1,5 +1,5 @@
1
1
  module Ec2
2
2
  module Clusterssh
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,62 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ec2-clusterssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
5
- prerelease:
4
+ version: 0.3.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Glenn Poston
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-12-18 00:00:00.000000000 Z
11
+ date: 2015-01-09 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.3'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.3'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: aws-sdk
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  description: Use instance tags to launch a ClusterSSH session to multiple EC2 instances.
@@ -67,7 +60,7 @@ executables:
67
60
  extensions: []
68
61
  extra_rdoc_files: []
69
62
  files:
70
- - .gitignore
63
+ - ".gitignore"
71
64
  - Gemfile
72
65
  - LICENSE.txt
73
66
  - README.md
@@ -79,26 +72,25 @@ files:
79
72
  homepage: https://github.com/gposton/ec2-clusterssh
80
73
  licenses:
81
74
  - MIT
75
+ metadata: {}
82
76
  post_install_message:
83
77
  rdoc_options: []
84
78
  require_paths:
85
79
  - lib
86
80
  required_ruby_version: !ruby/object:Gem::Requirement
87
- none: false
88
81
  requirements:
89
- - - '>='
82
+ - - ">="
90
83
  - !ruby/object:Gem::Version
91
84
  version: '0'
92
85
  required_rubygems_version: !ruby/object:Gem::Requirement
93
- none: false
94
86
  requirements:
95
- - - '>='
87
+ - - ">="
96
88
  - !ruby/object:Gem::Version
97
89
  version: '0'
98
90
  requirements: []
99
91
  rubyforge_project:
100
- rubygems_version: 1.8.25
92
+ rubygems_version: 2.4.5
101
93
  signing_key:
102
- specification_version: 3
94
+ specification_version: 4
103
95
  summary: Use instance tags to launch a ClusterSSH session to multiple EC2 instances.
104
96
  test_files: []