miasma-aws 0.1.20 → 0.1.22
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/CHANGELOG.md +5 -0
- data/lib/miasma-aws/version.rb +1 -1
- data/lib/miasma/contrib/aws.rb +37 -8
- data/lib/miasma/contrib/aws/orchestration.rb +23 -28
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b255feb4bbbd9158ce1928df6b560eafc4b481c5
|
4
|
+
data.tar.gz: 7d54dcb2b4b96012cab3e13d89a772604d9b378d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32ab9151988b38628bec1e50b96e3cc360624c04d656e7c959586a31e6c6bac8d4a5d5e17d2fb47108b01d6ef0dabfa7ecf97036841a29e1e54573453bbdbdcf
|
7
|
+
data.tar.gz: e3ceba8f15b6679679f333676a89fe7caa4ef250a047b75fcd5df15761ac50b42e46661cf15180957fed7af107dcabd91a68970aa548261ea546e2257d20b36a
|
data/CHANGELOG.md
CHANGED
data/lib/miasma-aws/version.rb
CHANGED
data/lib/miasma/contrib/aws.rb
CHANGED
@@ -344,7 +344,7 @@ module Miasma
|
|
344
344
|
attribute :aws_host, String
|
345
345
|
attribute :aws_bucket_region, String
|
346
346
|
attribute :api_endpoint, String, :required => true, :default => 'amazonaws.com'
|
347
|
-
attribute :euca_compat,
|
347
|
+
attribute :euca_compat, Symbol, :allowed_values => [:path, :dns], :coerce => lambda{|v| v.is_a?(String) ? v.to_sym : v}
|
348
348
|
attribute :euca_dns_map, Smash, :coerce => lambda{|v| v.to_smash}, :default => Smash.new
|
349
349
|
attribute :ssl_enabled, [TrueClass, FalseClass], :default => true
|
350
350
|
|
@@ -355,11 +355,13 @@ module Miasma
|
|
355
355
|
# AWS config file key remapping
|
356
356
|
klass.const_set(:CONFIG_FILE_REMAP,
|
357
357
|
Smash.new(
|
358
|
-
'region' => 'aws_region'
|
358
|
+
'region' => 'aws_region',
|
359
|
+
'role_arn' => 'aws_sts_role_arn'
|
359
360
|
)
|
360
361
|
)
|
361
362
|
klass.const_set(:INSTANCE_PROFILE_HOST, 'http://169.254.169.254')
|
362
363
|
klass.const_set(:INSTANCE_PROFILE_PATH, 'latest/meta-data/iam/security-credentials')
|
364
|
+
klass.const_set(:INSTANCE_PROFILE_AZ_PATH, 'latest/meta-data/placement/availability-zone')
|
363
365
|
end
|
364
366
|
|
365
367
|
# Build new API for specified type using current provider / creds
|
@@ -412,7 +414,13 @@ module Miasma
|
|
412
414
|
# @param creds [Hash]
|
413
415
|
# @return [TrueClass]
|
414
416
|
def load_instance_credentials!(creds)
|
415
|
-
role = HTTP.get(
|
417
|
+
role = HTTP.get(
|
418
|
+
[
|
419
|
+
self.class.const_get(:INSTANCE_PROFILE_HOST),
|
420
|
+
self.class.const_get(:INSTANCE_PROFILE_PATH),
|
421
|
+
''
|
422
|
+
].join('/')
|
423
|
+
).body.to_s.strip
|
416
424
|
data = HTTP.get(
|
417
425
|
[
|
418
426
|
self.class.const_get(:INSTANCE_PROFILE_HOST),
|
@@ -420,10 +428,27 @@ module Miasma
|
|
420
428
|
role
|
421
429
|
].join('/')
|
422
430
|
).body
|
431
|
+
unless(data.is_a?(Hash))
|
432
|
+
begin
|
433
|
+
data = MultiJson.load(data.to_s)
|
434
|
+
rescue MultiJson::ParseError
|
435
|
+
data = {}
|
436
|
+
end
|
437
|
+
end
|
423
438
|
creds[:aws_access_key_id] = data['AccessKeyId']
|
424
439
|
creds[:aws_secret_access_key] = data['SecretAccessKey']
|
425
440
|
creds[:aws_sts_token] = data['Token']
|
426
441
|
creds[:aws_sts_token_expires] = Time.xmlschema(data['Expiration'])
|
442
|
+
unless(creds[:aws_region])
|
443
|
+
az = HTTP.get(
|
444
|
+
[
|
445
|
+
self.class.const_get(:INSTANCE_PROFILE_HOST),
|
446
|
+
self.class.const_get(:INSTANCE_PROFILE_AZ_PATH)
|
447
|
+
].join('/')
|
448
|
+
).body.to_s.strip
|
449
|
+
az.sub!(/[a-zA-Z]+$/, '')
|
450
|
+
creds[:aws_region] = az
|
451
|
+
end
|
427
452
|
true
|
428
453
|
end
|
429
454
|
|
@@ -486,12 +511,16 @@ module Miasma
|
|
486
511
|
end
|
487
512
|
end
|
488
513
|
end
|
489
|
-
|
514
|
+
|
515
|
+
l_profile = l_config.fetch(profile, Smash.new)
|
516
|
+
l_source_profile = l_config.fetch(l_profile[:source_profile], Smash.new)
|
517
|
+
|
518
|
+
l_creds = l_config.fetch(
|
490
519
|
:default, Smash.new
|
491
520
|
).merge(
|
492
|
-
|
493
|
-
|
494
|
-
|
521
|
+
l_source_profile
|
522
|
+
).merge(
|
523
|
+
l_profile
|
495
524
|
)
|
496
525
|
else
|
497
526
|
Smash.new
|
@@ -506,7 +535,7 @@ module Miasma
|
|
506
535
|
self.class.const_defined?(:EUCA_API_SERVICE) ?
|
507
536
|
self.class::EUCA_API_SERVICE :
|
508
537
|
self.class::API_SERVICE
|
509
|
-
)
|
538
|
+
)
|
510
539
|
else
|
511
540
|
service_name = self.class::API_SERVICE.downcase
|
512
541
|
end
|
@@ -13,6 +13,8 @@ module Miasma
|
|
13
13
|
|
14
14
|
# Service name of the API
|
15
15
|
API_SERVICE = 'cloudformation'
|
16
|
+
# Service name of the eucalyptus API
|
17
|
+
EUCA_API_SERVICE = 'CloudFormation'
|
16
18
|
# Supported version of the AutoScaling API
|
17
19
|
API_VERSION = '2010-05-15'
|
18
20
|
|
@@ -63,35 +65,27 @@ module Miasma
|
|
63
65
|
descriptions = all_result_pages(nil, :body, 'DescribeStacksResponse', 'DescribeStacksResult', 'Stacks', 'member') do |options|
|
64
66
|
request(
|
65
67
|
:path => '/',
|
66
|
-
:
|
67
|
-
:method => :
|
68
|
+
:params => options.merge(d_params),
|
69
|
+
:method => :get
|
68
70
|
)
|
69
71
|
end
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
72
|
+
else
|
73
|
+
lists = all_result_pages(nil, :body, 'ListStacksResponse', 'ListStacksResult', 'StackSummaries', 'member') do |options|
|
74
|
+
request(
|
75
|
+
:path => '/',
|
76
|
+
:form => options.merge(l_params),
|
77
|
+
:method => :post
|
76
78
|
)
|
77
|
-
).get(:body, 'GetStackPolicyResult', 'StackPolicyBody')
|
78
|
-
if(policy)
|
79
|
-
descriptions.first[:stack_policy] = MultiJson.load(policy).to_smash
|
80
79
|
end
|
81
|
-
else
|
82
80
|
descriptions = []
|
83
81
|
end
|
84
|
-
lists
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
desc = descriptions.detect do |d_stk|
|
92
|
-
d_stk['StackId'] == stk['StackId']
|
93
|
-
end || Smash.new
|
94
|
-
stk.merge!(desc)
|
82
|
+
(lists || descriptions).map do |stk|
|
83
|
+
if(lists)
|
84
|
+
desc = descriptions.detect do |d_stk|
|
85
|
+
d_stk['StackId'] == stk['StackId']
|
86
|
+
end || Smash.new
|
87
|
+
stk.merge!(desc)
|
88
|
+
end
|
95
89
|
if(stack)
|
96
90
|
next if stack.id != stk['StackId'] && stk['StackId'].split('/')[1] != stack.id
|
97
91
|
end
|
@@ -136,7 +130,8 @@ module Miasma
|
|
136
130
|
}
|
137
131
|
],
|
138
132
|
:custom => Smash.new(
|
139
|
-
:
|
133
|
+
:stack_policy => stk['StackPolicyBody'],
|
134
|
+
:stack_policy_url => stk['StackPolicyURL']
|
140
135
|
)
|
141
136
|
).valid_state
|
142
137
|
end
|
@@ -314,8 +309,8 @@ module Miasma
|
|
314
309
|
results = all_result_pages(nil, :body, 'DescribeStackResourcesResponse', 'DescribeStackResourcesResult', 'StackResources', 'member') do |options|
|
315
310
|
request(
|
316
311
|
:path => '/',
|
317
|
-
:method => :
|
318
|
-
:
|
312
|
+
:method => :get,
|
313
|
+
:params => options.merge(
|
319
314
|
Smash.new(
|
320
315
|
'Action' => 'DescribeStackResources',
|
321
316
|
'StackName' => stack.id
|
@@ -354,8 +349,8 @@ module Miasma
|
|
354
349
|
results = all_result_pages(nil, :body, 'DescribeStackEventsResponse', 'DescribeStackEventsResult', 'StackEvents', 'member') do |options|
|
355
350
|
request(
|
356
351
|
:path => '/',
|
357
|
-
:method => :
|
358
|
-
:
|
352
|
+
:method => :get,
|
353
|
+
:params => options.merge(
|
359
354
|
'Action' => 'DescribeStackEvents',
|
360
355
|
'StackName' => stack.id
|
361
356
|
)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: miasma-aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: miasma
|
@@ -134,9 +134,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
136
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.
|
137
|
+
rubygems_version: 2.4.8
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: Smoggy AWS API
|
141
141
|
test_files: []
|
142
|
-
has_rdoc:
|