ssssh 1.0.2 → 1.0.3.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/bin/ssssh +16 -2
  3. data/lib/ssssh/version.rb +1 -1
  4. data/ssssh.gemspec +1 -0
  5. metadata +18 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eef52cc397abec11348e1c17be44d31adf552a56
4
- data.tar.gz: a1673a612e4cac2b428e55d04a5dcef21ea58335
3
+ metadata.gz: 6a5c9d4c0908c44b114bf15b7a6dc03d3283f4b1
4
+ data.tar.gz: 05188a2034589b493874968956b9dcb1de4b9399
5
5
  SHA512:
6
- metadata.gz: ccfab41aa8f45b245b2c87d1011736efcb87f628b18a23fa793c42df933dbf350c9c1c6d433d83f906bee6a45fa9c96fa57deaabcb0175c630a55a36e1b94dd8
7
- data.tar.gz: e44a896cc694db6b11f768c827e30350d4bca6fb4b7a33931765b4f7ad1eece187e3a8e6e0321bd8f87243767c6dd74a59560e9ffda16047b94c85666ee1aac4
6
+ metadata.gz: 99882112b0dd4d6fd72c60c8c0cb98d08e38e672952829dea604d4e77f96fcda6b321305e0936c3d7bf6a027aeb3476fd3f16e60dba8d2ba08fe32ad0eb33dc3
7
+ data.tar.gz: 8c43e7b844bca55baccb46603ee45e71ed6610474245536ea8ac3a99f0e0123d2288c0976b3ee553e9ce0e822ab32a1d4c6d6544a4546c516c38223fb8a91360
data/bin/ssssh CHANGED
@@ -4,12 +4,13 @@ require "aws-sdk-core"
4
4
  require "base64"
5
5
  require "clamp"
6
6
  require "logger"
7
+ require "multi_json"
7
8
  require "ssssh/version"
8
9
 
9
10
  Clamp do
10
11
 
11
12
  option ["--region"], "REGION", "AWS region",
12
- :environment_variable => "AWS_REGION"
13
+ :environment_variable => "AWS_REGION", :required => true
13
14
  option "--access-key", "KEY", "AWS access key",
14
15
  :environment_variable => "AWS_ACCESS_KEY_ID",
15
16
  :attribute_name => :access_key_id
@@ -63,7 +64,7 @@ Clamp do
63
64
  protected
64
65
 
65
66
  def default_region
66
- ENV["AWS_REGION"] || ENV["AWS_DEFAULT_REGION"]
67
+ ENV["AWS_REGION"] || ENV["AWS_DEFAULT_REGION"] || ec2_instance_metadata["region"]
67
68
  end
68
69
 
69
70
  def logger
@@ -73,6 +74,7 @@ Clamp do
73
74
  end
74
75
 
75
76
  def aws_config
77
+ # signal_error "No --region specified" unless region
76
78
  {
77
79
  :access_key_id => access_key_id,
78
80
  :secret_access_key => secret_access_key,
@@ -82,6 +84,18 @@ Clamp do
82
84
  }.reject { |k,v| v.nil? || v == "" }
83
85
  end
84
86
 
87
+ def ec2_instance_metadata
88
+ uri = URI("http://169.254.169.254/latest/dynamic/instance-identity/document")
89
+ http = Net::HTTP.new(uri.host, uri.port)
90
+ http.open_timeout = 1
91
+ document = http.start do
92
+ http.request_get(uri.path).body
93
+ end
94
+ MultiJson.load(document)
95
+ rescue Net::OpenTimeout
96
+ {}
97
+ end
98
+
85
99
  def with_kms
86
100
  yield Aws::KMS::Client.new(aws_config)
87
101
  rescue Aws::KMS::Errors::ServiceError => e
data/lib/ssssh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ssssh
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3.beta1"
3
3
  end
data/ssssh.gemspec CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_runtime_dependency "aws-sdk-core", "~> 2.0"
25
25
  spec.add_runtime_dependency "clamp", ">= 0.6.4"
26
+ spec.add_runtime_dependency "multi_json"
26
27
 
27
28
  spec.add_development_dependency "bundler", "~> 1.7"
28
29
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-26 00:00:00.000000000 Z
11
+ date: 2015-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.6.4
41
+ - !ruby/object:Gem::Dependency
42
+ name: multi_json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -98,9 +112,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
98
112
  version: '0'
99
113
  required_rubygems_version: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - ">="
115
+ - - ">"
102
116
  - !ruby/object:Gem::Version
103
- version: '0'
117
+ version: 1.3.1
104
118
  requirements: []
105
119
  rubyforge_project:
106
120
  rubygems_version: 2.2.2