Skip to content

Commit 26ec83c

Browse files
committed
fix file path error
1 parent 1850735 commit 26ec83c

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

lib/instance_agent/platform/linux_util.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ def self.extract_tgz(bundle_file, dst)
3333
def self.supports_process_groups?()
3434
true
3535
end
36+
37+
def self.codedeploy_version_file
38+
File.join(ProcessManager::Config.config[:root_dir], '..')
39+
end
3640

3741
private
3842
def self.execute_tar_command(cmd)

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

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,19 @@ class DeployAgentVersion < Seahorse::Client::Plugin
44
class Handler < Seahorse::Client::Handler
55
def initialize(handler = nil)
66
@handler = handler
7-
file_path = get_version_tracking_file
7+
file_path = File.expand_path(File.join(InstanceAgent::Platform.util.codedeploy_version_file, '.version'))
88
if File.exist?(file_path)
99
@agent_version ||= File.read(file_path).split(': ').last.strip
1010
else
1111
@agent_version ||= "UNKNOWN_VERSION"
12-
log(:warn, "Version tracking file either does not exist or cannot be read.")
12+
log(:warn, "Version tracking file either does not exist or cannot be read in #{file_path}.")
1313
end
1414
end
1515

1616
def call(context)
1717
context.http_request.headers['x-amz-codedeploy-agent-version'] = @agent_version
1818
@handler.call(context)
1919
end
20-
21-
def get_version_tracking_file
22-
version_dir = ProcessManager::Config.config[:root_dir]
23-
if version_dir.eql? 'Amazon/CodeDeploy'
24-
file_path = File.join(version_dir, '.version')
25-
else
26-
file_path = File.join(version_dir, '..', '.version')
27-
end
28-
end
2920

3021
private
3122
def log(severity, message)

0 commit comments

Comments
 (0)