debut 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/debut/aws.rb +10 -3
- data/lib/debut/version.rb +1 -1
- data/tests/aws_tests.rb +2 -4
- metadata +1 -1
data/Gemfile.lock
CHANGED
data/lib/debut/aws.rb
CHANGED
@@ -27,6 +27,15 @@ module LiveTribe
|
|
27
27
|
require 'fog'
|
28
28
|
|
29
29
|
def initialize(attributes)
|
30
|
+
attributes = attributes.dup
|
31
|
+
|
32
|
+
attributes[:use_iam_profile] = !ENV.include?('AWS_ACCESS_KEY')
|
33
|
+
attributes[:use_iam_profile] = !ENV.include?('AWS_SECRET_ACCESS_KEY')
|
34
|
+
|
35
|
+
if attributes[:use_iam_profile]
|
36
|
+
puts 'Using IAM profile'
|
37
|
+
end
|
38
|
+
|
30
39
|
@dns = Fog::DNS.new(attributes)
|
31
40
|
|
32
41
|
@hostname = LiveTribe::Debut::Debutante::USE_ENVIRONMENT
|
@@ -155,9 +164,7 @@ module LiveTribe
|
|
155
164
|
path = INSTANCE_PUBLIC_HOSTNAME_PATH
|
156
165
|
end
|
157
166
|
|
158
|
-
|
159
|
-
|
160
|
-
hostname = metadata['hostname']
|
167
|
+
hostname = connection.get(:path => path, :expects => 200).body
|
161
168
|
end
|
162
169
|
|
163
170
|
hostname
|
data/lib/debut/version.rb
CHANGED
data/tests/aws_tests.rb
CHANGED
@@ -103,8 +103,7 @@ class TestAws < MiniTest::Unit::TestCase
|
|
103
103
|
aws.hostname = LiveTribe::Debut::Debutante::USE_ENVIRONMENT
|
104
104
|
aws.use_local_hostname = false
|
105
105
|
|
106
|
-
|
107
|
-
Excon.stub({:method => :get, :path => '/latest/meta-data/public-hostname'}, {:status => 200, :body => Fog::JSON.encode(meta_data)})
|
106
|
+
Excon.stub({:method => :get, :path => '/latest/meta-data/public-hostname'}, {:status => 200, :body =>'public_hostname'})
|
108
107
|
|
109
108
|
hostname = aws.send :collect_hostname
|
110
109
|
|
@@ -120,8 +119,7 @@ class TestAws < MiniTest::Unit::TestCase
|
|
120
119
|
aws.hostname = LiveTribe::Debut::Debutante::USE_ENVIRONMENT
|
121
120
|
aws.use_local_hostname = true
|
122
121
|
|
123
|
-
|
124
|
-
Excon.stub({:method => :get, :path => '/latest/meta-data/local-hostname'}, {:status => 200, :body => Fog::JSON.encode(meta_data)})
|
122
|
+
Excon.stub({:method => :get, :path => '/latest/meta-data/local-hostname'}, {:status => 200, :body => 'local_hostname'})
|
125
123
|
|
126
124
|
hostname = aws.send :collect_hostname
|
127
125
|
|