eb-connect 0.1.0 → 0.2.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/lib/eb-connect.rb +3 -30
- data/lib/eb-connect/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9787445490f8d83b56af048b78ccde92ddc64bf
|
4
|
+
data.tar.gz: eeaff31dbd98442d9a65e4b53431a6f953079b50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4191bdff7e1936422a2a180409db88fea885a1cb1a3067896f2b1b9cf324a11f6c24b01643f0a5ff829f0f8ea254e25cd918bb33201e7b61a075a00a1628626
|
7
|
+
data.tar.gz: 32350943b400c5e3deff716fb8e30cbb5792d4e6633b0dae6188b8b903d6201dc1faaeca190cfef155f673e168042cf62ad62933245e3b6bc70d3f6357510d53
|
data/lib/eb-connect.rb
CHANGED
@@ -3,10 +3,6 @@ require 'aws-sdk'
|
|
3
3
|
|
4
4
|
module ElasticBeanstalk
|
5
5
|
class Driver
|
6
|
-
def initialize
|
7
|
-
Aws.config.update(region: 'us-east-1')
|
8
|
-
end
|
9
|
-
|
10
6
|
def ask?(question, options)
|
11
7
|
answer = nil
|
12
8
|
answer = options[0] if options.length == 1
|
@@ -30,7 +26,7 @@ module ElasticBeanstalk
|
|
30
26
|
|
31
27
|
def connect
|
32
28
|
begin
|
33
|
-
user = Aws::
|
29
|
+
user = Aws::STS::Client.new.get_caller_identity
|
34
30
|
rescue Aws::Errors::MissingCredentialsError
|
35
31
|
puts "Uh oh. AWS Credentials could not be found!", ""
|
36
32
|
puts "Do one of the following, then try eb-connect again:"
|
@@ -77,37 +73,14 @@ module ElasticBeanstalk
|
|
77
73
|
instance_id: instance[:instance_id],
|
78
74
|
name: "#{name_tag ? name_tag.value : ""} (#{ip})",
|
79
75
|
ip: ip,
|
80
|
-
key_name: instance[:key_name],
|
81
76
|
}
|
82
77
|
end.sort_by { |option| option[:name] }
|
83
78
|
|
84
79
|
instance = ask?("Instances", instances)
|
85
80
|
|
86
|
-
|
87
|
-
pem_filename = "#{instance[:key_name]}.pem"
|
88
|
-
|
89
|
-
if instance[:key_name] && !ENV['KEY_DIR'] && !present_pems.include?(pem_filename)
|
90
|
-
puts "\n\nWhere are your keys located?"
|
91
|
-
ENV['KEY_DIR'] = gets.chomp
|
92
|
-
end
|
93
|
-
|
94
|
-
cmd = ["ssh"]
|
95
|
-
|
96
|
-
if present_pems.include?(pem_filename)
|
97
|
-
cmd << "-i #{pem_filename}"
|
98
|
-
elsif !ENV['KEY_DIR'].nil? && !ENV['KEY_DIR'].empty? && !instance[:key_name].nil?
|
99
|
-
cmd << "-i #{ENV['KEY_DIR']}/#{pem_filename}"
|
100
|
-
end
|
101
|
-
|
102
|
-
cmd << "#{"ec2-user@" if instance[:key_name]}#{instance[:ip]}"
|
103
|
-
|
104
|
-
ssh_cmd = cmd.join(" ")
|
105
|
-
|
81
|
+
ssh_cmd = "ssh #{instance[:ip]}"
|
106
82
|
puts "", ssh_cmd
|
107
|
-
|
108
|
-
if $?.exitstatus == 255
|
109
|
-
puts "","Did you properly set ENV['KEY_DIR']? (= #{ENV['KEY_DIR'] or "nil"})"
|
110
|
-
end
|
83
|
+
exec ssh_cmd
|
111
84
|
end
|
112
85
|
end
|
113
86
|
end
|
data/lib/eb-connect/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eb-connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spencer Ellinor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
90
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.
|
91
|
+
rubygems_version: 2.6.8
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: Ease EB instance SSH connections
|