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 +4 -4
- data/README.md +1 -1
- data/bin/cluster +26 -11
- data/lib/ec2/clusterssh/version.rb +1 -1
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46ff2974ac83b84c572b07c6ba2b1d6d5bc2430b
|
4
|
+
data.tar.gz: b6fbf9f6d5c51fa52d7d75f32c49261dcb095757
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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] [-
|
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' =>
|
10
|
-
'region' => 'us-
|
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
|
-
|
33
|
+
Aws.config.update({:region => options['region']})
|
34
34
|
|
35
|
-
ec2 =
|
35
|
+
ec2 = Aws::EC2::Client.new
|
36
36
|
|
37
37
|
# filter instances based on tags
|
38
|
-
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
|
-
|
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.
|
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
|
|
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.
|
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-
|
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
|
-
-
|
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.
|
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.
|