Skip to content

Commit d48f3bd

Browse files
authored
Merge pull request #405 from aws/1.7.x
1.7.x
2 parents 061a789 + fbb3ccf commit d48f3bd

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

codedeploy_agent.gemspec

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |spec|
22
spec.name = 'aws_codedeploy_agent'
3-
spec.version = '1.7.0'
3+
spec.version = '1.7.1'
44
spec.summary = 'Packages AWS CodeDeploy agent libraries'
55
spec.description = 'AWS CodeDeploy agent is responsible for doing the actual work of deploying software on an individual EC2 instance'
66
spec.author = 'Amazon Web Services'
@@ -13,13 +13,14 @@ Gem::Specification.new do |spec|
1313

1414
spec.add_dependency('gli', '~> 2.21')
1515
spec.add_dependency('json_pure', '~> 1.6')
16-
spec.add_dependency('archive-tar-minitar', '~> 0.5.2')
16+
spec.add_dependency('minitar', '~> 0.6.1')
1717
spec.add_dependency('rubyzip', '~> 1.3.0')
1818
spec.add_dependency('logging', '~> 2.2')
1919
spec.add_dependency('aws-sdk-core', '~> 3')
2020
spec.add_dependency('aws-sdk-s3', '~> 1')
2121
spec.add_dependency('docopt', '~> 0.5.0')
2222
spec.add_dependency('concurrent-ruby', '~> 1.1.9')
23+
spec.add_dependency('rexml', '~> 3.3.9')
2324

2425
spec.add_development_dependency('rake', '~> 12.3.3')
2526
spec.add_development_dependency('rspec', '~> 3.2.0')

vendor/gems/codedeploy-commands-1.0.0/lib/aws/plugins/deploy_control_endpoint.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require 'aws-sdk-core'
2+
require 'json'
23

34
module Aws
45
module Plugins
@@ -20,10 +21,29 @@ class DeployControlEndpoint < Seahorse::Client::Plugin
2021
if InstanceMetadata.imds_supported?
2122
region = InstanceMetadata.region
2223
domain = InstanceMetadata.domain
24+
25+
if is_on_prem?
26+
partitions_region_pattern = File.read(File.join(File.dirname(__FILE__), 'partition-region-pattern.json'))
27+
partitions_region_pattern_hash = JSON.parse(partitions_region_pattern)
28+
29+
unless partitions_region_pattern_hash.include?(domain)
30+
raise "Unknown domain: #{domain}"
31+
end
32+
33+
known_region_pattern = partitions_region_pattern_hash[domain]["regionRegex"]
34+
35+
unless region.match(known_region_pattern)
36+
raise "Invalid region: #{region}"
37+
end
38+
end
39+
40+
ProcessManager::Log.info("Creating client url from IMDS region and domain")
2341
else
2442
region = cfg.region
2543
domain = 'amazonaws.com'
2644
domain += '.cn' if region.split("-")[0] == 'cn'
45+
46+
ProcessManager::Log.info("Creating client url from configurations")
2747
end
2848

2949
url = "https://#{service}.#{region}.#{domain}"
@@ -32,6 +52,10 @@ class DeployControlEndpoint < Seahorse::Client::Plugin
3252
ProcessManager::Log.info("CodeDeploy endpoint: #{url}")
3353
url
3454
end
55+
56+
def self.is_on_prem?
57+
return File.readable?(InstanceAgent::Config.config[:on_premises_config_file])
58+
end
3559
end
3660
end
3761
end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"amazonaws.com": {
3+
"regionRegex" : "^[0-9a-z-]{1,20}$"
4+
},
5+
6+
"amazonaws.com.cn": {
7+
"regionRegex" : "^cn\\-\\w+\\-\\d+$"
8+
}
9+
}

0 commit comments

Comments
 (0)