Skip to content

Commit 143f99e

Browse files
committed
[Fix] Moved AWS loading till after config is resolved
AWS::CodeDeployCommand requires that runtime configurations be resolved before it is able to accurately load up its API definition. This update allows the Windows version of the Agent to provide AWS::CodeDeployCommand the opportunity to resolve those config settings with minimal impact to the wider codebase.
1 parent 86bd40e commit 143f99e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/winagent.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
require 'instance_agent/log'
1111
require 'instance_agent/platform'
1212
require 'instance_agent/platform/windows_util'
13-
require 'instance_agent/plugins/codedeploy/register_plugin'
1413
require 'pathname'
1514

1615
include Win32
@@ -102,4 +101,11 @@ def with_error_handling
102101
end
103102
end
104103

104+
# InstanceAgentService loads in a set of configurations that are assumed by the CodeDeploy plugin registery to be in place when the
105+
# the classes are loaded. This happens to be true for the Linux agent as `GLI::App.pre` loads up the config before resolving additional
106+
# gem dependencies. However, Aws.add_service requires that the service be defined when the gem is loaded so there is not an efficient way
107+
# to resolve this at runtime; thus, the config must be resolved before the CodeDeployCommand class is loaded.
108+
InstanceAgentService.new.read_config unless defined?(Ocra)
109+
require 'instance_agent/plugins/codedeploy/register_plugin'
110+
105111
InstanceAgentService.mainloop unless defined?(Ocra)

vendor/gems/codedeploy-commands-1.0.0/lib/aws/add_service_wrapper.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ def self.add_service(name, options = {})
4343
module_name: module_name,
4444
api: api_hash,
4545
paginators: options[:paginators],
46-
paginators: options[:paginators],
4746
waiters: options[:waiters],
4847
resources: options[:resources],
4948
gem_dependencies: { 'aws-sdk-core' => '3' },

0 commit comments

Comments
 (0)