Skip to content

Commit 1850735

Browse files
committed
remove version directory from config file
1 parent 0938fe1 commit 1850735

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

conf/codedeployagent.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@
55
:program_name: codedeploy-agent
66
:root_dir: '/opt/codedeploy-agent/deployment-root'
77
:verbose: false
8-
:version_dir: '/opt/codedeploy-agent/'
98
:wait_between_runs: 1
109
:proxy_uri:

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,28 @@ class DeployAgentVersion < Seahorse::Client::Plugin
44
class Handler < Seahorse::Client::Handler
55
def initialize(handler = nil)
66
@handler = handler
7-
file_path = File.join(ProcessManager::Config.config[:version_dir], '.version')
7+
file_path = get_version_tracking_file
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 doesn't exist in directory #{file_path}")
12+
log(:warn, "Version tracking file either does not exist or cannot be read.")
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
2029

2130
private
2231
def log(severity, message)

0 commit comments

Comments
 (0)