ec2-ssh 1.0.7 → 1.1.0
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.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/ec2-ssh.rb +1 -1
- data/lib/ec2-ssh/aws.rb +12 -6
- data/lib/ec2-ssh/cli.rb +7 -6
- data/lib/ec2-ssh/ssh.rb +3 -3
- metadata +18 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7fc4d61b4b6469b8a4c7ff5f1a40cefab2782ac
|
4
|
+
data.tar.gz: 4cd60c018fc113b9746adfd30e52c713bd4d2a77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 811f77f8b9dfb8e626da2b2581b12d9530cbaf7808649ae0bc727b1a4c3b9ff6a1f91bbe1120ef8be30ed8a95d9bd74cca7f8218327fd34454473ebc5159e8ce
|
7
|
+
data.tar.gz: 6803e2d985724957600fe947db7288bfcdc9f88414967617fe7f608c37caad6ff9e61ccdf9cac7fb831fe2f3b1b53c51166c18194ac4593187ffcc61d9f3fc16
|
data/README.md
CHANGED
@@ -83,6 +83,7 @@ Options:
|
|
83
83
|
c, [--capture-output=CAPTURE_OUTPUT] # capture output
|
84
84
|
[--upload=source,destination] # upload a file - source,destination (make sure seperate these by comma)
|
85
85
|
[--download=source,destination] # download a file - source,destination (make sure seperate these by comma)
|
86
|
+
[--pty=PTY] # enable pty for sudo operations
|
86
87
|
|
87
88
|
Connect to autoscale instance (random instance), Pass --cmd='whatever' to run a cmd on the server (use ; to seperate commands)
|
88
89
|
````
|
data/lib/ec2-ssh.rb
CHANGED
data/lib/ec2-ssh/aws.rb
CHANGED
@@ -10,24 +10,30 @@ module Ec2Ssh::Cli::Aws
|
|
10
10
|
say "Currently running AWS User is: #{Aws::IAM::CurrentUser.new.arn}"
|
11
11
|
end
|
12
12
|
|
13
|
-
def get_auto_scale_groups
|
13
|
+
def get_auto_scale_groups(grep_pattern)
|
14
14
|
say "Fetching AutoScale Groups - please wait..."
|
15
15
|
@as_groups = @as.describe_auto_scaling_groups({max_records: 100}).auto_scaling_groups
|
16
16
|
|
17
17
|
as_group_names = @as_groups.inject([]) {|acc, asg| acc << asg.auto_scaling_group_name; acc }
|
18
18
|
|
19
19
|
as_selection = {}
|
20
|
-
|
20
|
+
|
21
|
+
if grep_pattern
|
22
|
+
as_groups = as_group_names.grep(grep_pattern)
|
23
|
+
else
|
24
|
+
as_groups = as_group_names
|
25
|
+
end
|
26
|
+
as_groups.each_with_index.inject(as_selection) {|acc, pair|
|
21
27
|
element, index = pair
|
22
28
|
as_selection[index] = element
|
23
29
|
acc
|
24
|
-
}
|
25
|
-
|
30
|
+
}
|
31
|
+
|
26
32
|
say "AutoScale Group in #{options[:region]}:\n"
|
27
33
|
as_selection.each {|k,v| say "#{k}: #{v}"}
|
28
34
|
|
29
35
|
selected_as = ask("Which server group do you want to ssh to?", color = :yellow)
|
30
|
-
|
36
|
+
|
31
37
|
get_instances('aws:autoscaling:groupName', as_selection[selected_as.to_i])
|
32
38
|
end
|
33
39
|
|
@@ -52,7 +58,7 @@ module Ec2Ssh::Cli::Aws
|
|
52
58
|
})
|
53
59
|
|
54
60
|
if !response.reservations.empty?
|
55
|
-
response.reservations.each {|r| r.instances.inject(@all_servers){|acc, k|
|
61
|
+
response.reservations.each {|r| r.instances.inject(@all_servers){|acc, k|
|
56
62
|
if k.public_ip_address.nil?
|
57
63
|
say "Could not find public ip address for instance: #{k.instance_id}, falling back to private ip address", color = :yellow
|
58
64
|
acc << k.private_ip_address; acc
|
data/lib/ec2-ssh/cli.rb
CHANGED
@@ -27,20 +27,21 @@ class Ec2Ssh::Cli < Thor
|
|
27
27
|
method_option :groups_limit, :aliases => 'l', :desc => 'limit', :type => :numeric
|
28
28
|
method_option :wait, :aliases => 'w', :desc => 'wait', :type => :numeric
|
29
29
|
method_option :as, :desc => 'filter by autoscale groups'
|
30
|
+
method_option :grep, :desc => 'grep autoscale name when list is fecthed'
|
30
31
|
method_option :tag_key, :desc => 'tag key to filter instances by', :default => 'Name'
|
31
32
|
method_option :tag_value, :desc => 'tag value to filter instances by'
|
32
33
|
method_option :terminal, :aliases => 't', :desc => 'open terminal tabs for all servers'
|
33
34
|
method_option :capture_output, :aliases => 'c', :desc => 'capture output'
|
34
35
|
method_option :upload, :desc => 'upload a file - source,destination (make sure seperate these by comma)', :banner => 'source,destination'
|
35
36
|
method_option :download, :desc => 'download a file - source,destination (make sure seperate these by comma)', :banner => 'source,destination'
|
36
|
-
method_option :pty, :desc => 'enable pty for sudo operations', :default => false
|
37
|
+
method_option :pty, :desc => 'enable pty for sudo operations', :type => :boolean, :default => false
|
37
38
|
def connect
|
38
39
|
extend Aws
|
39
40
|
extend Ssh
|
40
41
|
extend Utils
|
41
42
|
set_ssh(options[:user], options[:pty])
|
42
43
|
aws_init(options[:profile], options[:region])
|
43
|
-
|
44
|
+
|
44
45
|
if options[:as]
|
45
46
|
get_auto_scale_groups
|
46
47
|
elsif options[:tag_value]
|
@@ -50,7 +51,7 @@ class Ec2Ssh::Cli < Thor
|
|
50
51
|
Ec2Ssh::Cli.start(%w{help connect})
|
51
52
|
exit
|
52
53
|
end
|
53
|
-
|
54
|
+
|
54
55
|
if options[:terminal]
|
55
56
|
open_in_terminal
|
56
57
|
else
|
@@ -64,12 +65,12 @@ class Ec2Ssh::Cli < Thor
|
|
64
65
|
mode = :groups if options[:groups]
|
65
66
|
mode = :sequence if options[:sequence]
|
66
67
|
|
67
|
-
mode = :parallel if mode.nil?
|
68
|
+
mode = :parallel if mode.nil?
|
68
69
|
dsl_options = {}
|
69
70
|
dsl_options[:in] = mode
|
70
71
|
dsl_options[:wait] = options[:wait] if options[:wait]
|
71
72
|
dsl_options[:limit] = options[:groups_limit] if options[:groups_limit]
|
72
|
-
|
73
|
+
|
73
74
|
say "dsl opts: #{dsl_options}", color = :cyan
|
74
75
|
ssh_to(options[:user], dsl_options, options[:cmd], options[:capture_output], options[:upload], options[:download])
|
75
76
|
end
|
@@ -79,6 +80,6 @@ class Ec2Ssh::Cli < Thor
|
|
79
80
|
desc "version", "version"
|
80
81
|
def version
|
81
82
|
say Ec2Ssh::ABOUT, color = :green
|
82
|
-
end
|
83
|
+
end
|
83
84
|
|
84
85
|
end
|
data/lib/ec2-ssh/ssh.rb
CHANGED
@@ -25,7 +25,7 @@ module Ec2Ssh::Cli::Ssh
|
|
25
25
|
file = upload.split(',').map { |e| e.strip }
|
26
26
|
source = File.expand_path(file.first)
|
27
27
|
destination = file.last
|
28
|
-
puts "uploading #{source} to #{destination}
|
28
|
+
puts "uploading #{source} to #{destination}"
|
29
29
|
upload! source, destination
|
30
30
|
end
|
31
31
|
|
@@ -33,8 +33,8 @@ module Ec2Ssh::Cli::Ssh
|
|
33
33
|
file = download.split(',').map { |e| e.strip }
|
34
34
|
source = file.first
|
35
35
|
destination = File.expand_path(file.last)
|
36
|
-
puts "downloading #{source} to #{destination}
|
37
|
-
download! source, destination
|
36
|
+
puts "downloading #{source} to #{destination}.#{host}"
|
37
|
+
download! source, "#{destination}.#{host}"
|
38
38
|
end
|
39
39
|
|
40
40
|
if capture_output
|
metadata
CHANGED
@@ -1,73 +1,73 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ec2-ssh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ami Mahloof
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.19'
|
20
|
-
- -
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 0.19.1
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - ~>
|
27
|
+
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0.19'
|
30
|
-
- -
|
30
|
+
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.19.1
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: aws-sdk
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - ~>
|
37
|
+
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: 2.0.45
|
40
|
-
- -
|
40
|
+
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 2.0.45
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - ~>
|
47
|
+
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: 2.0.45
|
50
|
-
- -
|
50
|
+
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 2.0.45
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: sshkit
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - ~>
|
57
|
+
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: 1.7.1
|
60
|
-
- -
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: 1.7.1
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - ~>
|
67
|
+
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 1.7.1
|
70
|
-
- -
|
70
|
+
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: 1.7.1
|
73
73
|
description: EC2 SSH Utility
|
@@ -79,7 +79,7 @@ extra_rdoc_files:
|
|
79
79
|
- README.md
|
80
80
|
- LICENSE
|
81
81
|
files:
|
82
|
-
- .gitignore
|
82
|
+
- ".gitignore"
|
83
83
|
- LICENSE
|
84
84
|
- README.md
|
85
85
|
- Rakefile
|
@@ -100,17 +100,17 @@ require_paths:
|
|
100
100
|
- lib
|
101
101
|
required_ruby_version: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
|
-
- -
|
103
|
+
- - ">="
|
104
104
|
- !ruby/object:Gem::Version
|
105
105
|
version: '0'
|
106
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 1.3.6
|
111
111
|
requirements: []
|
112
112
|
rubyforge_project:
|
113
|
-
rubygems_version: 2.4.
|
113
|
+
rubygems_version: 2.4.5.1
|
114
114
|
signing_key:
|
115
115
|
specification_version: 4
|
116
116
|
summary: run commmands on multiple servers by tag or by autoscale group
|