lib/dpl/providers/opsworks.rb in dpl-2.0.3.beta.4 vs lib/dpl/providers/opsworks.rb in dpl-2.0.5.beta

- old
+ new

@@ -1,18 +1,21 @@ +# frozen_string_literal: true + module Dpl module Providers class Opsworks < Provider register :opsworks status :stable full_name 'AWS OpsWorks' - description sq(<<-str) + description sq(<<-STR) tbd - str + STR + gem 'nokogiri', '~> 1.15' gem 'aws-sdk-opsworks', '~> 1.0' env :aws, :opsworks config '~/.aws/credentials', '~/.aws/config', prefix: 'aws' @@ -25,21 +28,21 @@ opt '--migrate', 'Migrate the database.' opt '--wait_until_deployed', 'Wait until the app is deployed and return the deployment status.' opt '--update_on_success', 'When wait-until-deployed and updated-on-success are both not given, application source is updated to the current SHA. Ignored when wait-until-deployed is not given.', alias: :update_app_on_success opt '--custom_json JSON', 'Custom json options override (overwrites default configuration)' - msgs login: 'Using Access Key: %{access_key_id}', + msgs login: 'Using Access Key: %{access_key_id}', create_deploy: 'Creating deployment ... ', - done: 'Done: %s', - waiting: 'Deploying ', - failed: 'Failed.', - success: 'Success.', - update_app: 'Updating application source branch/revision setting.', + done: 'Done: %s', + waiting: 'Deploying ', + failed: 'Failed.', + success: 'Success.', + update_app: 'Updating application source branch/revision setting.', app_not_found: 'App %s not found.', - timeout: 'Timeout: failed to finish deployment within 10 minutes.', + timeout: 'Timeout: failed to finish deployment within 10 minutes.', service_error: 'Deployment failed. OpsWorks service error: %s', - comment: 'Deploy build %{build_number} via Travis CI' + comment: 'Deploy build %{build_number} via Travis CI' def login info :login end @@ -56,17 +59,17 @@ wait_until_deployed(id) if wait_until_deployed? end def deploy_config compact( - stack_id: stack_id, - app_id: app_id, + stack_id:, + app_id:, command: { name: 'deploy' }, - comment: comment, - custom_json: custom_json, - instance_ids: instance_ids, - layer_ids: layer_ids + comment:, + custom_json:, + instance_ids:, + layer_ids: ) end def wait_until_deployed(id) print :waiting @@ -87,13 +90,13 @@ opsworks.update_app(update_config) end def update_config { - app_id: app_id, + app_id:, app_source: { - revision: git_sha, + revision: git_sha } } end def custom_json @@ -116,27 +119,27 @@ super || sha end def describe_app data = opsworks.describe_apps(app_ids: [app_id]) - error :app_not_found, app_id unless data[:apps] && data[:apps].any? + error :app_not_found, app_id unless data[:apps]&.any? data[:apps].first end def describe_deployments(id) opsworks.describe_deployments(deployment_ids: [id]) end def opsworks - @opsworks ||= Aws::OpsWorks::Client.new(region: region, credentials: credentials) + @opsworks ||= Aws::OpsWorks::Client.new(region:, credentials:) end def credentials Aws::Credentials.new(access_key_id, secret_access_key) end def timeout(sec, &block) - Timeout::timeout(sec, &block) + Timeout.timeout(sec, &block) rescue Timeout::Error error :timeout end end end