ec2-clusterssh 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83d88a4cea26fe56c682d7e9dcec4c9a10051547
4
- data.tar.gz: db0f883685623e31a2ed911f7d4916f538c2c379
3
+ metadata.gz: 46ff2974ac83b84c572b07c6ba2b1d6d5bc2430b
4
+ data.tar.gz: b6fbf9f6d5c51fa52d7d75f32c49261dcb095757
5
5
  SHA512:
6
- metadata.gz: 24679afc44231152ccb2bde8cf7b22e3ecfef0fc229eef753f9981ef61bc2eff56e5219ad1b543753a301b8df214157b1bdacb39aa90eb27aff90a627ca8279a
7
- data.tar.gz: 3e994e22717df3fa5d66999c15b80a57e582a656dedf863f002e44b0afa3e01a03ec1a2b53ccc52da41ad498352ce391c630189ae5d42227745ef1ee9c3677d3
6
+ metadata.gz: cedcc5fcd0ce1da794f43740edf16d86fe98b605822618e0ffdeacece8cf46377ef01cd9482ef22b340bc65fe9ce44c735de9a3f351e9c30cc36e55f67ed4612
7
+ data.tar.gz: 56cabbe7570ce1db77c4704050202e4b26fb36d3373589389e3d055b35cff56e164df2421820f094a53432dfffd7d2d4da3bb6c5656662b1d19c64fc62a4e14e
data/README.md CHANGED
@@ -30,7 +30,7 @@ NOTE: Some linux users have reported problems using /etc/csshrc, but have had su
30
30
  ## Usage
31
31
 
32
32
  $cluster -h
33
- Usage: cluster [-t TAGS] [-l USER] [-k KEY -s SECRET] [-r region]
33
+ Usage: cluster [-t TAGS] [-l USER] [-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
36
  -r, --region [REGION] AWS region
data/bin/cluster CHANGED
@@ -6,8 +6,8 @@ require 'aws-sdk'
6
6
 
7
7
  options = {
8
8
  'user' => 'ec2-user',
9
- 'use_private_ip' => false,
10
- 'region' => 'us-east-1'
9
+ 'use_private_ip' => true,
10
+ 'region' => 'us-west-2'
11
11
  }
12
12
 
13
13
  OptionParser.new do |opts|
@@ -30,17 +30,36 @@ OptionParser.new do |opts|
30
30
  end
31
31
  end.parse!
32
32
 
33
- AWS.config(:region => options['region'])
33
+ Aws.config.update({:region => options['region']})
34
34
 
35
- ec2 = AWS::EC2.new
35
+ ec2 = Aws::EC2::Client.new
36
36
 
37
37
  # filter instances based on tags
38
- instances = ec2.instances
38
+ instances = []
39
39
  options['tags'].each do |tag|
40
40
  tag = tag.split('=')
41
41
  key = tag[0]
42
42
  values = tag[1].split(',')
43
- instances = instances.tagged(key).tagged_values(values)
43
+ response = ec2.describe_instances(filters: [{:name => "tag-key", :values => [key]}])
44
+ if response.reservations[0].nil?
45
+ puts "No instances in #{options['region']} had a tag named '#{key}'"
46
+ next
47
+ else
48
+ response.reservations.each do |reservation|
49
+ reservation.instances.each do |instance|
50
+ puts instance.tags
51
+ tag_value = instance.tags.keep_if{|instance_tag| instance_tag[:key] == key}[0][:value]
52
+ if values.include? tag_value
53
+ instances << instance
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+
60
+ if instances.length == 0
61
+ puts "No instnaces matched filter: #{options['tags']}"
62
+ exit 1
44
63
  end
45
64
 
46
65
  # get dns entries for cssh
@@ -48,13 +67,9 @@ dns = nil
48
67
  if options['use_private_ip']
49
68
  dns = instances.map{|instance| instance.private_ip_address}
50
69
  else
51
- dns = instances.map{|instance| instance.dns_name}
70
+ dns = instances.map{|instance| instance.public_ip_address}
52
71
  end
53
72
 
54
- if dns.length == 0
55
- puts "No instances matched #{options['tags']}"
56
- exit
57
- end
58
73
 
59
74
  cssh = (/darwin/ =~ RUBY_PLATFORM) ? 'csshX' : 'cssh'
60
75
 
@@ -1,5 +1,5 @@
1
1
  module Ec2
2
2
  module Clusterssh
3
- VERSION = "0.3.2"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ec2-clusterssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Glenn Poston
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-09 00:00:00.000000000 Z
11
+ date: 2015-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: aws-sdk
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: Use instance tags to launch a ClusterSSH session to multiple EC2 instances.
@@ -60,7 +60,7 @@ executables:
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - ".gitignore"
63
+ - .gitignore
64
64
  - Gemfile
65
65
  - LICENSE.txt
66
66
  - README.md
@@ -79,17 +79,17 @@ require_paths:
79
79
  - lib
80
80
  required_ruby_version: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - ">="
82
+ - - '>='
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  requirements: []
91
91
  rubyforge_project:
92
- rubygems_version: 2.4.5
92
+ rubygems_version: 2.0.14
93
93
  signing_key:
94
94
  specification_version: 4
95
95
  summary: Use instance tags to launch a ClusterSSH session to multiple EC2 instances.