aws-codedeploy-agent 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +5 -1
- data/.travis.yml +10 -0
- data/CHANGES.md +5 -0
- data/Gemfile +6 -3
- data/README.md +35 -0
- data/Rakefile +52 -0
- data/aws-codedeploy-agent.gemspec +5 -10
- data/conf/codedeployagent.yml +1 -0
- data/features/AwsCredentials.yml +4 -0
- data/features/agent.feature +11 -0
- data/features/aws_credentials.rb +35 -0
- data/features/step_definitions.rb +233 -0
- data/init.d/codedeploy-agent +11 -6
- data/lib/instance_agent.rb +1 -1
- data/lib/instance_agent/config.rb +3 -1
- data/lib/instance_agent/log.rb +18 -0
- data/lib/instance_agent/platform/linux_util.rb +27 -5
- data/lib/instance_agent/plugins/codedeploy/application_specification/application_specification.rb +2 -1
- data/lib/instance_agent/plugins/codedeploy/application_specification/file_info.rb +2 -2
- data/lib/instance_agent/plugins/codedeploy/application_specification/script_info.rb +3 -2
- data/lib/instance_agent/plugins/codedeploy/codedeploy_control.rb +15 -14
- data/lib/instance_agent/plugins/codedeploy/command_executor.rb +34 -6
- data/lib/instance_agent/plugins/codedeploy/command_poller.rb +12 -1
- data/lib/instance_agent/plugins/codedeploy/deployment_specification.rb +2 -12
- data/lib/instance_agent/plugins/codedeploy/hook_executor.rb +8 -4
- data/lib/instance_agent/plugins/codedeploy/install_instruction.rb +3 -1
- data/lib/instance_metadata.rb +1 -1
- data/test/instance_agent/config_test.rb +3 -1
- data/test/instance_agent/platform/linux_util_test.rb +35 -0
- data/test/instance_agent/plugins/codedeploy/application_specification_test.rb +7 -6
- data/test/instance_agent/plugins/codedeploy/command_executor_test.rb +13 -10
- data/test/instance_agent/plugins/codedeploy/command_poller_test.rb +28 -6
- data/test/instance_agent/plugins/codedeploy/deployment_specification_test.rb +9 -9
- data/test/instance_agent/plugins/codedeploy/hook_executor_test.rb +12 -4
- data/test/test_helper.rb +6 -1
- data/vendor/gems/codedeploy-commands/apis/CodeDeployCommand.api.json +1 -0
- data/vendor/gems/codedeploy-commands/lib/aws/codedeploy_commands.rb +2 -0
- data/vendor/gems/codedeploy-commands/lib/aws/plugins/deploy_agent_version.rb +31 -0
- data/vendor/gems/codedeploy-commands/lib/aws/plugins/deploy_control_endpoint.rb +1 -12
- data/vendor/gems/process_manager/lib/process_manager/master.rb +3 -3
- data/vendor/specifications/codedeploy-commands-1.0.0.gemspec +5 -5
- metadata +52 -149
- data/vendor/gems/codedeploy-commands/codedeploy-commands-1.0.0.gemspec +0 -28
- data/vendor/gems/process_manager/process_manager-0.0.13.gemspec +0 -42
- data/vendor/specifications/aws-sdk-core-2.0.42.gemspec +0 -37
- data/vendor/specifications/builder-3.2.2.gemspec +0 -29
- data/vendor/specifications/gli-2.5.6.gemspec +0 -51
- data/vendor/specifications/jmespath-1.0.1.gemspec +0 -29
- data/vendor/specifications/little-plugger-1.1.3.gemspec +0 -32
- data/vendor/specifications/logging-1.8.1.gemspec +0 -44
- data/vendor/specifications/multi_json-1.7.7.gemspec +0 -30
- data/vendor/specifications/multi_json-1.8.4.gemspec +0 -30
- data/vendor/specifications/multi_xml-0.5.5.gemspec +0 -30
- data/vendor/specifications/simple_pid-0.2.1.gemspec +0 -28
@@ -27,7 +27,9 @@ class InstanceAgentConfigTest < InstanceAgentTestCase
|
|
27
27
|
:wait_between_runs => 30,
|
28
28
|
:wait_after_error => 30,
|
29
29
|
:codedeploy_test_profile => 'prod',
|
30
|
-
:on_premises_config_file => '/etc/codedeploy-agent/conf/codedeploy.onpremises.yml'
|
30
|
+
:on_premises_config_file => '/etc/codedeploy-agent/conf/codedeploy.onpremises.yml',
|
31
|
+
:proxy_uri => nil,
|
32
|
+
:enable_deployments_log => true
|
31
33
|
}, InstanceAgent::Config.config)
|
32
34
|
end
|
33
35
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class LinuxUtilTest < InstanceAgentTestCase
|
4
|
+
context 'Testing building command with sudo' do
|
5
|
+
setup do
|
6
|
+
@script_mock = Struct.new :sudo, :runas
|
7
|
+
end
|
8
|
+
|
9
|
+
should 'return command with sudo with runas user deploy' do
|
10
|
+
mock = @script_mock.new true, "deploy"
|
11
|
+
assert_equal 'sudo su deploy -c my_script.sh',
|
12
|
+
InstanceAgent::LinuxUtil.prepare_script_command(mock, "my_script.sh")
|
13
|
+
end
|
14
|
+
|
15
|
+
should 'return command without sudo with runas user deploy' do
|
16
|
+
mock = @script_mock.new nil, "deploy"
|
17
|
+
assert_equal 'su deploy -c my_script.sh',
|
18
|
+
InstanceAgent::LinuxUtil.prepare_script_command(mock, "my_script.sh")
|
19
|
+
end
|
20
|
+
|
21
|
+
should 'return command without sudo or runas user' do
|
22
|
+
mock = @script_mock.new nil, nil
|
23
|
+
assert_equal 'my_script.sh',
|
24
|
+
InstanceAgent::LinuxUtil.prepare_script_command(mock, "my_script.sh")
|
25
|
+
end
|
26
|
+
|
27
|
+
should 'return command with sudo' do
|
28
|
+
mock = @script_mock.new true, nil
|
29
|
+
assert_equal 'sudo my_script.sh',
|
30
|
+
InstanceAgent::LinuxUtil.prepare_script_command(mock, "my_script.sh")
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
@@ -6,7 +6,12 @@ module InstanceAgent
|
|
6
6
|
module Plugins
|
7
7
|
module CodeDeployPlugin
|
8
8
|
module ApplicationSpecification
|
9
|
+
|
9
10
|
class ApplicationSpecificationTest < InstanceAgentTestCase
|
11
|
+
def make_app_spec
|
12
|
+
ApplicationSpecification.new(YAML.load(@app_spec_string), {:revision_id => @test_revision_id})
|
13
|
+
end
|
14
|
+
|
10
15
|
context 'The Application Specification' do
|
11
16
|
setup do
|
12
17
|
@test_revision_id = 'bar'
|
@@ -14,10 +19,6 @@ module InstanceAgent
|
|
14
19
|
|
15
20
|
private
|
16
21
|
|
17
|
-
def make_app_spec
|
18
|
-
ApplicationSpecification.new(YAML.load(@app_spec_string), {:revision_id => @test_revision_id})
|
19
|
-
end
|
20
|
-
|
21
22
|
context "With missing version" do
|
22
23
|
setup do
|
23
24
|
@app_spec_string = <<-END
|
@@ -271,7 +272,7 @@ module InstanceAgent
|
|
271
272
|
end
|
272
273
|
|
273
274
|
should "raise and AppSpecValidationException" do
|
274
|
-
assert_raised_with_message('File needs to have a destination',AppSpecValidationException) do
|
275
|
+
assert_raised_with_message('File test_source needs to have a destination',AppSpecValidationException) do
|
275
276
|
make_app_spec()
|
276
277
|
end
|
277
278
|
end
|
@@ -1710,4 +1711,4 @@ module InstanceAgent
|
|
1710
1711
|
end
|
1711
1712
|
end
|
1712
1713
|
end
|
1713
|
-
end
|
1714
|
+
end
|
@@ -1,11 +1,18 @@
|
|
1
1
|
require 'test_helper'
|
2
|
+
require 'certificate_helper'
|
2
3
|
require 'stringio'
|
3
|
-
require 'com/amazon/codedeploy/command/v20141006/host_command_instance'
|
4
4
|
require 'aws-sdk-core/s3'
|
5
5
|
|
6
6
|
class CodeDeployPluginCommandExecutorTest < InstanceAgentTestCase
|
7
7
|
|
8
8
|
include InstanceAgent::Plugins::CodeDeployPlugin
|
9
|
+
def generate_signed_message_for(map)
|
10
|
+
message = @cert_helper.sign_message(map.to_json)
|
11
|
+
spec = OpenStruct.new({ :payload => message })
|
12
|
+
spec.format = "PKCS7/JSON"
|
13
|
+
|
14
|
+
return spec
|
15
|
+
end
|
9
16
|
|
10
17
|
context 'The CodeDeploy Plugin Command Executor' do
|
11
18
|
setup do
|
@@ -33,13 +40,6 @@ class CodeDeployPluginCommandExecutorTest < InstanceAgentTestCase
|
|
33
40
|
end
|
34
41
|
|
35
42
|
context "when executing a command" do
|
36
|
-
def generate_signed_message_for(map)
|
37
|
-
message = @cert_helper.sign_message(map.to_json)
|
38
|
-
spec = OpenStruct.new({ :payload => message })
|
39
|
-
spec.format = "PKCS7/JSON"
|
40
|
-
|
41
|
-
return spec
|
42
|
-
end
|
43
43
|
|
44
44
|
setup do
|
45
45
|
@cert_helper = CertificateHelper.new
|
@@ -62,7 +62,7 @@ class CodeDeployPluginCommandExecutorTest < InstanceAgentTestCase
|
|
62
62
|
"S3Revision" => @s3Revision
|
63
63
|
}
|
64
64
|
})
|
65
|
-
@command =
|
65
|
+
@command = OpenStruct.new(
|
66
66
|
:host_command_identifier => "command-1",
|
67
67
|
:deployment_execution_id => "test-execution")
|
68
68
|
@root_dir = '/tmp/codedeploy/'
|
@@ -184,6 +184,7 @@ class CodeDeployPluginCommandExecutorTest < InstanceAgentTestCase
|
|
184
184
|
@mock_file = mock
|
185
185
|
Net::HTTP.stubs(:start).yields(@http)
|
186
186
|
File.stubs(:open).returns @mock_file
|
187
|
+
Dir.stubs(:entries).returns []
|
187
188
|
@mock_file.stubs(:close)
|
188
189
|
@http.stubs(:request_get)
|
189
190
|
@s3 = mock
|
@@ -364,7 +365,8 @@ class CodeDeployPluginCommandExecutorTest < InstanceAgentTestCase
|
|
364
365
|
:application_name => @application_name,
|
365
366
|
:deployment_id => @deployment_id,
|
366
367
|
:deployment_group_name => @deployment_group_name,
|
367
|
-
:
|
368
|
+
:deployment_group_id => @deployment_group_id,
|
369
|
+
:deployment_root_dir => @deployment_root_dir,
|
368
370
|
:last_successful_deployment_dir => nil,
|
369
371
|
:app_spec_path => 'appspec.yml'}
|
370
372
|
@mock_hook_executor = mock
|
@@ -502,6 +504,7 @@ class CodeDeployPluginCommandExecutorTest < InstanceAgentTestCase
|
|
502
504
|
:application_name => @application_name,
|
503
505
|
:deployment_id => @deployment_id,
|
504
506
|
:deployment_group_name => @deployment_group_name,
|
507
|
+
:deployment_group_id => @deployment_group_id,
|
505
508
|
:last_successful_deployment_dir => nil,
|
506
509
|
:app_spec_path => 'appspec.yml'}
|
507
510
|
@hook_executor_constructor_hash_1 = hook_executor_constructor_hash.merge({:lifecycle_event => "lifecycle_event_1"})
|
@@ -255,34 +255,56 @@ class CommandPollerTest < InstanceAgentTestCase
|
|
255
255
|
@poller.perform
|
256
256
|
end
|
257
257
|
|
258
|
-
should '
|
258
|
+
should 'call PutHostCommandComplete when Succeeded status is given by PollHostCommandAcknowledgement' do
|
259
259
|
@deploy_control_client.expects(:put_host_command_acknowledgement).
|
260
260
|
with(:diagnostics => nil,
|
261
261
|
:host_command_identifier => @command.host_command_identifier).
|
262
262
|
returns(stub(:command_status => "Succeeded"))
|
263
263
|
|
264
|
+
@deploy_control_client.expects(:put_host_command_complete).
|
265
|
+
with(
|
266
|
+
:command_status => 'Succeeded',
|
267
|
+
:diagnostics => {
|
268
|
+
:format => "JSON",
|
269
|
+
:payload => {
|
270
|
+
'error_code' => InstanceAgent::Plugins::CodeDeployPlugin::ScriptError::SUCCEEDED_CODE,
|
271
|
+
'script_name' => "",
|
272
|
+
'message' => 'Succeeded',
|
273
|
+
'log' => ""}.to_json
|
274
|
+
},
|
275
|
+
:host_command_identifier => @command.host_command_identifier)
|
276
|
+
|
264
277
|
@get_deployment_specification_state.become('never')
|
265
278
|
@deploy_control_client.expects(:get_deployment_specification).never.
|
266
279
|
when(@get_deployment_specification_state.is('never'))
|
267
280
|
@put_host_command_complete_state.become('never')
|
268
|
-
@deploy_control_client.expects(:put_host_command_complete).never.
|
269
|
-
when(@put_host_command_complete_state.is('never'))
|
270
281
|
|
271
282
|
@poller.perform
|
272
283
|
end
|
273
284
|
|
274
|
-
should '
|
285
|
+
should 'call PutHostCommandComplete when Failed status is given by PollHostCommandAcknowledgement' do
|
275
286
|
@deploy_control_client.expects(:put_host_command_acknowledgement).
|
276
287
|
with(:diagnostics => nil,
|
277
288
|
:host_command_identifier => @command.host_command_identifier).
|
278
289
|
returns(stub(:command_status => "Failed"))
|
279
290
|
|
291
|
+
@deploy_control_client.expects(:put_host_command_complete).
|
292
|
+
with(
|
293
|
+
:command_status => 'Failed',
|
294
|
+
:diagnostics => {
|
295
|
+
:format => "JSON",
|
296
|
+
:payload => {
|
297
|
+
'error_code' => InstanceAgent::Plugins::CodeDeployPlugin::ScriptError::UNKNOWN_ERROR_CODE,
|
298
|
+
'script_name' => "",
|
299
|
+
'message' => 'Failed',
|
300
|
+
'log' => ""}.to_json
|
301
|
+
},
|
302
|
+
:host_command_identifier => @command.host_command_identifier)
|
303
|
+
|
280
304
|
@get_deployment_specification_state.become('never')
|
281
305
|
@deploy_control_client.expects(:get_deployment_specification).never.
|
282
306
|
when(@get_deployment_specification_state.is('never'))
|
283
307
|
@put_host_command_complete_state.become('never')
|
284
|
-
@deploy_control_client.expects(:put_host_command_complete).never.
|
285
|
-
when(@put_host_command_complete_state.is('never'))
|
286
308
|
|
287
309
|
@poller.perform
|
288
310
|
end
|
@@ -3,15 +3,15 @@ require 'ostruct'
|
|
3
3
|
require 'certificate_helper'
|
4
4
|
|
5
5
|
class DeploymentSpecificationTest < InstanceAgentTestCase
|
6
|
-
context 'The Deployment Specification' do
|
7
|
-
def generate_signed_message_for(map)
|
8
|
-
message = @cert_helper.sign_message(map.to_json)
|
9
|
-
spec = OpenStruct.new({ :payload => message })
|
10
|
-
spec.format = "PKCS7/JSON"
|
11
6
|
|
12
|
-
|
13
|
-
|
7
|
+
def generate_signed_message_for(map)
|
8
|
+
message = @cert_helper.sign_message(map.to_json)
|
9
|
+
spec = OpenStruct.new({ :payload => message })
|
10
|
+
spec.format = "PKCS7/JSON"
|
11
|
+
return spec
|
12
|
+
end
|
14
13
|
|
14
|
+
context 'The Deployment Specification' do
|
15
15
|
setup do
|
16
16
|
@cert_helper = CertificateHelper.new
|
17
17
|
@deployment_id = SecureRandom.uuid.to_s
|
@@ -37,8 +37,8 @@ class DeploymentSpecificationTest < InstanceAgentTestCase
|
|
37
37
|
|
38
38
|
@packed_message = generate_signed_message_for(@deployment_spec)
|
39
39
|
InstanceAgent::Config.init
|
40
|
-
end
|
41
|
-
|
40
|
+
end
|
41
|
+
|
42
42
|
context "with JSON format" do
|
43
43
|
should "populate the deployment id" do
|
44
44
|
parsed_deployment_spec = InstanceAgent::Plugins::CodeDeployPlugin::DeploymentSpecification.parse(@packed_message)
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'stringio'
|
3
3
|
require 'fileutils'
|
4
|
-
require 'com/amazon/codedeploy/command/v20141006/host_command_instance'
|
5
4
|
|
6
5
|
class HookExecutorTest < InstanceAgentTestCase
|
7
6
|
|
@@ -12,6 +11,7 @@ class HookExecutorTest < InstanceAgentTestCase
|
|
12
11
|
:application_name => @application_name,
|
13
12
|
:deployment_id => @deployment_id,
|
14
13
|
:deployment_group_name => @deployment_group_name,
|
14
|
+
:deployment_group_id => @deployment_group_id,
|
15
15
|
:deployment_root_dir => @deployment_root_dir,
|
16
16
|
:last_successful_deployment_dir => @last_successful_deployment_dir,
|
17
17
|
:app_spec_path => @app_spec_path})
|
@@ -22,11 +22,16 @@ class HookExecutorTest < InstanceAgentTestCase
|
|
22
22
|
@deployment_id='12345'
|
23
23
|
@application_name='TestApplication'
|
24
24
|
@deployment_group_name='TestDeploymentGroup'
|
25
|
+
@deployment_group_id='foo'
|
25
26
|
@deployment_root_dir = "deployment/root/dir"
|
26
27
|
@last_successful_deployment_dir = "last/deployment/root/dir"
|
27
28
|
@app_spec_path = "app_spec"
|
28
29
|
@app_spec = { "version" => 0.0, "os" => "linux" }
|
29
30
|
YAML.stubs(:load).returns(@app_spec)
|
31
|
+
@root_dir = '/tmp/codedeploy'
|
32
|
+
logger = mock
|
33
|
+
logger.stubs(:log)
|
34
|
+
InstanceAgent::DeploymentLog.stubs(:instance).returns(logger)
|
30
35
|
end
|
31
36
|
|
32
37
|
context "when creating a hook command" do
|
@@ -41,6 +46,7 @@ class HookExecutorTest < InstanceAgentTestCase
|
|
41
46
|
:application_name => @application_name,
|
42
47
|
:deployment_id => @deployment_id,
|
43
48
|
:deployment_group_name => @deployment_group_name,
|
49
|
+
:deployment_group_id => @deployment_group_id,
|
44
50
|
:deployment_root_dir => @deployment_root_dir,
|
45
51
|
:app_spec_path => @app_spec_path})
|
46
52
|
end
|
@@ -56,7 +62,8 @@ class HookExecutorTest < InstanceAgentTestCase
|
|
56
62
|
assert_raise do
|
57
63
|
@hook_executor = HookExecutor.new ({:lifecycle_event => @lifecycle_event,
|
58
64
|
:application_name => @application_name,
|
59
|
-
:deployment_group_name => @
|
65
|
+
:deployment_group_name => @deployment_group_name,
|
66
|
+
:deployment_group_id => @deployment_group_id,
|
60
67
|
:deployment_id => @deployment_id,
|
61
68
|
:deployment_root_dir => @deployment_root_dir})
|
62
69
|
end
|
@@ -94,7 +101,8 @@ class HookExecutorTest < InstanceAgentTestCase
|
|
94
101
|
@child_env={'LIFECYCLE_EVENT' => @lifecycle_event.to_s,
|
95
102
|
'DEPLOYMENT_ID' => @deployment_id.to_s,
|
96
103
|
'APPLICATION_NAME' => @application_name.to_s,
|
97
|
-
'DEPLOYMENT_GROUP_NAME' => @deployment_group_name.to_s
|
104
|
+
'DEPLOYMENT_GROUP_NAME' => @deployment_group_name.to_s,
|
105
|
+
'DEPLOYMENT_GROUP_ID' => @deployment_group_id.to_s}
|
98
106
|
end
|
99
107
|
|
100
108
|
context "no scripts to run for a given hook" do
|
@@ -123,7 +131,7 @@ class HookExecutorTest < InstanceAgentTestCase
|
|
123
131
|
end
|
124
132
|
|
125
133
|
should "raise and exception" do
|
126
|
-
assert_raised_with_message(
|
134
|
+
assert_raised_with_message("Script does not exist at specified location: #{File.expand_path(@deployment_root_dir)}/deployment-archive/test", ScriptError)do
|
127
135
|
@hook_executor.execute
|
128
136
|
end
|
129
137
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,4 +1,9 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
$:.unshift "lib"
|
3
|
+
Gem.use_paths(nil, Gem.path << "vendor")
|
4
|
+
|
5
|
+
require 'coveralls'
|
6
|
+
Coveralls.wear!
|
2
7
|
require 'thread'
|
3
8
|
require 'rubygems'
|
4
9
|
require "bundler"
|
@@ -13,4 +18,4 @@ require 'base64'
|
|
13
18
|
|
14
19
|
# require local test helpers. If you need a helper write,
|
15
20
|
# keep this pattern or you'll be punished hard
|
16
|
-
require '
|
21
|
+
require 'instance_agent_helper'
|
@@ -3,6 +3,7 @@ gem_root = File.dirname(File.dirname(File.dirname(__FILE__)))
|
|
3
3
|
require 'aws-sdk-core'
|
4
4
|
require "#{gem_root}/lib/aws/plugins/certificate_authority"
|
5
5
|
require "#{gem_root}/lib/aws/plugins/deploy_control_endpoint"
|
6
|
+
require "#{gem_root}/lib/aws/plugins/deploy_agent_version"
|
6
7
|
|
7
8
|
version = '1.0.0'
|
8
9
|
|
@@ -15,4 +16,5 @@ bundled_apis.each do |svc_class_name, api_versions|
|
|
15
16
|
svc_class.const_set(:VERSION, version)
|
16
17
|
Aws::CodeDeployCommand::Client.add_plugin(Aws::Plugins::CertificateAuthority)
|
17
18
|
Aws::CodeDeployCommand::Client.add_plugin(Aws::Plugins::DeployControlEndpoint)
|
19
|
+
Aws::CodeDeployCommand::Client.add_plugin(Aws::Plugins::DeployAgentVersion)
|
18
20
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Aws
|
2
|
+
module Plugins
|
3
|
+
class DeployAgentVersion < Seahorse::Client::Plugin
|
4
|
+
class Handler < Seahorse::Client::Handler
|
5
|
+
def initialize(handler = nil)
|
6
|
+
@handler = handler
|
7
|
+
file_path = File.expand_path(File.join(InstanceAgent::Platform.util.codedeploy_version_file, '.version'))
|
8
|
+
if File.exist?(file_path)
|
9
|
+
@agent_version ||= File.read(file_path).split(': ').last.strip
|
10
|
+
else
|
11
|
+
@agent_version ||= "UNKNOWN_VERSION"
|
12
|
+
log(:warn, "Version tracking file either does not exist or cannot be read in #{file_path}.")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def call(context)
|
17
|
+
context.http_request.headers['x-amz-codedeploy-agent-version'] = @agent_version
|
18
|
+
@handler.call(context)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
def log(severity, message)
|
23
|
+
raise ArgumentError, "Unknown severity #{severity.inspect}" unless InstanceAgent::Log::SEVERITIES.include?(severity.to_s)
|
24
|
+
InstanceAgent::Log.send(severity.to_sym, "#{message}")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
handler(Handler)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -6,18 +6,7 @@ module Aws
|
|
6
6
|
option(:endpoint) do |cfg|
|
7
7
|
url = ENV['AWS_DEPLOY_CONTROL_ENDPOINT']
|
8
8
|
if url.nil?
|
9
|
-
|
10
|
-
when "us-east-1"
|
11
|
-
url = "https://codedeploy-commands.us-east-1.amazonaws.com"
|
12
|
-
when "us-west-2"
|
13
|
-
url = "https://codedeploy-commands.us-west-2.amazonaws.com"
|
14
|
-
when "eu-west-1"
|
15
|
-
url = "https://codedeploy-commands.eu-west-1.amazonaws.com"
|
16
|
-
when "ap-southeast-2"
|
17
|
-
url = "https://codedeploy-commands.ap-southeast-2.amazonaws.com"
|
18
|
-
else
|
19
|
-
raise "Not able to find an endpoint. Unknown region."
|
20
|
-
end
|
9
|
+
url = "https://codedeploy-commands.#{cfg.region}.amazonaws.com"
|
21
10
|
end
|
22
11
|
url
|
23
12
|
end
|
@@ -163,10 +163,10 @@ module ProcessManager
|
|
163
163
|
|
164
164
|
def handle_pid_file
|
165
165
|
@file_lock ||= File.open(pid_lock_file, File::RDWR|File::CREAT, 0644)
|
166
|
-
|
166
|
+
lock_acquired = @file_lock.flock(File::LOCK_EX | File::LOCK_NB)
|
167
167
|
|
168
|
-
if
|
169
|
-
ProcessManager::Log.info("Could not
|
168
|
+
if lock_acquired == false
|
169
|
+
ProcessManager::Log.info("Could not acquire lock on #{pid_lock_file} - aborting start!")
|
170
170
|
self.class.abort
|
171
171
|
|
172
172
|
elsif File.exists?(pid_file)
|
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.authors = ["Amazon Web Services"]
|
9
9
|
s.date = "2015-06-30"
|
10
10
|
s.description = "Provides client libraries for CodeDeploy Command."
|
11
|
-
s.files = ["lib/aws/
|
12
|
-
s.homepage = "https://
|
11
|
+
s.files = ["lib/aws/codedeploy_commands.rb", "lib/aws/plugins/certificate_authority.rb", "lib/aws/plugins/deploy_control_endpoint.rb", "apis/CodeDeployCommand.api.json"]
|
12
|
+
s.homepage = "https://devcentral.amazon.com/ac/brazil/directory/package/overview/Ruby-codedeploy-commands"
|
13
13
|
s.licenses = ["Apache 2.0"]
|
14
14
|
s.require_paths = ["lib"]
|
15
15
|
s.rubygems_version = "1.8.23.2"
|
@@ -19,11 +19,11 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.specification_version = 3
|
20
20
|
|
21
21
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
22
|
-
s.add_runtime_dependency(%q<aws-sdk-core>, ["
|
22
|
+
s.add_runtime_dependency(%q<aws-sdk-core>, ["~> 2.2.0"])
|
23
23
|
else
|
24
|
-
s.add_dependency(%q<aws-sdk-core>, ["
|
24
|
+
s.add_dependency(%q<aws-sdk-core>, ["~> 2.2.0"])
|
25
25
|
end
|
26
26
|
else
|
27
|
-
s.add_dependency(%q<aws-sdk-core>, ["
|
27
|
+
s.add_dependency(%q<aws-sdk-core>, ["~> 2.2.0"])
|
28
28
|
end
|
29
29
|
end
|