Class: InstanceAgent::Plugins::CodeDeployPlugin::CodeDeployControl
- Inherits:
-
Object
- Object
- InstanceAgent::Plugins::CodeDeployPlugin::CodeDeployControl
- Defined in:
- lib/instance_agent/plugins/codedeploy/codedeploy_control.rb
Instance Method Summary collapse
- #get_client ⇒ Object
-
#initialize(options = {}) ⇒ CodeDeployControl
constructor
A new instance of CodeDeployControl.
- #ssl_verify_peer ⇒ Object
- #validate_ssl_config ⇒ Object
- #verify_cert_fields ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ CodeDeployControl
Returns a new instance of CodeDeployControl.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/instance_agent/plugins/codedeploy/codedeploy_control.rb', line 10 def initialize( = {}) @options = .update({ :http_read_timeout => InstanceAgent::Config.config[:http_read_timeout] }) if InstanceAgent::Config.config[:log_aws_wire] @options = .update({ # wire logs might be huge; customers should be careful about turning them on # allow 1GB of old wire logs in 64MB chunks :logger => Logger.new( File.join(InstanceAgent::Config.config[:log_dir], "#{InstanceAgent::Config.config[:program_name]}.aws_wire.log"), 16, 64 * 1024 * 1024), :http_wire_trace => true}) end if InstanceAgent::Config.config[:proxy_uri] @options = .update({ :http_proxy => URI(InstanceAgent::Config.config[:proxy_uri]) }) end end |
Instance Method Details
#get_client ⇒ Object
40 41 42 |
# File 'lib/instance_agent/plugins/codedeploy/codedeploy_control.rb', line 40 def get_client Aws::CodeDeployCommand::Client.new(@options) end |
#ssl_verify_peer ⇒ Object
44 45 46 |
# File 'lib/instance_agent/plugins/codedeploy/codedeploy_control.rb', line 44 def ssl_verify_peer get_client.config.ssl_verify_peer end |
#validate_ssl_config ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/instance_agent/plugins/codedeploy/codedeploy_control.rb', line 32 def validate_ssl_config errors = [] errors << "Invalid aws sdk security configuration" unless ssl_verify_peer errors << "Invalid server certificate" unless verify_cert_fields errors.each{|error| InstanceAgent::Log.error("Error validating the SSL configuration: " + error)} errors.empty? end |
#verify_cert_fields ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/instance_agent/plugins/codedeploy/codedeploy_control.rb', line 48 def verify_cert_fields deploy_control_endpoint = get_client.config.endpoint begin cert_verifier = InstanceAgent::Plugins::CodeDeployPlugin::CodeDeployControlCertVerifier.new(deploy_control_endpoint) cert_verifier.verify_cert rescue Exception => e InstanceAgent::Log.error("#{self.class.to_s}: Error during certificate verification on codedeploy endpoint #{deploy_control_endpoint}") InstanceAgent::Log.debug("#{self.class.to_s}: #{e.inspect}") false end end |