File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
vendor/gems/codedeploy-commands-1.0.0/lib/aws/plugins Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 5
5
:program_name : codedeploy-agent
6
6
:root_dir : ' /opt/codedeploy-agent/deployment-root'
7
7
:verbose : false
8
- :version_dir : ' /opt/codedeploy-agent/'
9
8
:wait_between_runs : 1
10
9
:proxy_uri:
Original file line number Diff line number Diff line change @@ -4,19 +4,28 @@ class DeployAgentVersion < Seahorse::Client::Plugin
4
4
class Handler < Seahorse ::Client ::Handler
5
5
def initialize ( handler = nil )
6
6
@handler = handler
7
- file_path = File . join ( ProcessManager :: Config . config [ :version_dir ] , '.version' )
7
+ file_path = get_version_tracking_file
8
8
if File . exist? ( file_path )
9
9
@agent_version ||= File . read ( file_path ) . split ( ': ' ) . last . strip
10
10
else
11
11
@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. " )
13
13
end
14
14
end
15
15
16
16
def call ( context )
17
17
context . http_request . headers [ 'x-amz-codedeploy-agent-version' ] = @agent_version
18
18
@handler . call ( context )
19
19
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
20
29
21
30
private
22
31
def log ( severity , message )
You can’t perform that action at this time.
0 commit comments