From 20f74d13388f1851716fa502205157208743e7c5 Mon Sep 17 00:00:00 2001 From: Jimmy Zhang Date: Mon, 30 Apr 2018 18:23:11 +1000 Subject: [PATCH 1/3] fix multi region issue --- lib/cap-ec2/ec2-handler.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/cap-ec2/ec2-handler.rb b/lib/cap-ec2/ec2-handler.rb index cc32a6e..52c9cc0 100644 --- a/lib/cap-ec2/ec2-handler.rb +++ b/lib/cap-ec2/ec2-handler.rb @@ -95,10 +95,14 @@ def instance_has_tag?(instance, key, value) def instance_status_ok?(instance) @ec2.any? do |_, ec2| - ec2.describe_instance_status( - instance_ids: [instance.instance_id], - filters: [{ name: 'instance-status.status', values: %w(ok) }] - ).instance_statuses.length == 1 + begin + ec2.describe_instance_status( + instance_ids: [instance.instance_id], + filters: [{ name: 'instance-status.status', values: %w(ok) }] + ).instance_statuses.length == 1 + rescue Aws::EC2::Errors::InvalidInstanceIDNotFound + false + end end end end From 05b78c40acf87f1abdb00bb4eb39d7b78bf12790 Mon Sep 17 00:00:00 2001 From: Jimmy Zhang Date: Sat, 19 Jan 2019 00:36:49 +1100 Subject: [PATCH 2/3] fix: YAML.load being run on incorrect string --- lib/cap-ec2/utils.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cap-ec2/utils.rb b/lib/cap-ec2/utils.rb index 2c7a38d..8ce920e 100644 --- a/lib/cap-ec2/utils.rb +++ b/lib/cap-ec2/utils.rb @@ -56,7 +56,7 @@ def load_config config_location = File.expand_path(fetch(:ec2_config), Dir.pwd) if fetch(:ec2_config) if config_location && File.exists?(config_location) - config = YAML.load(ERB.new(File.read(fetch(:ec2_config)))) + config = YAML.load(ERB.new(File.read(fetch(:ec2_config))).result) if config set :ec2_project_tag, config['project_tag'] if config['project_tag'] set :ec2_roles_tag, config['roles_tag'] if config['roles_tag'] From 7ae505f7f221a787de3cf431196e8df8ebf99c89 Mon Sep 17 00:00:00 2001 From: Jimmy Zhang Date: Wed, 8 Mar 2023 13:55:01 +0800 Subject: [PATCH 3/3] fix: ruby 3.2.0 --- lib/cap-ec2/utils.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cap-ec2/utils.rb b/lib/cap-ec2/utils.rb index 8ce920e..cc66033 100644 --- a/lib/cap-ec2/utils.rb +++ b/lib/cap-ec2/utils.rb @@ -55,7 +55,7 @@ def load_config end config_location = File.expand_path(fetch(:ec2_config), Dir.pwd) if fetch(:ec2_config) - if config_location && File.exists?(config_location) + if config_location && File.exist?(config_location) config = YAML.load(ERB.new(File.read(fetch(:ec2_config))).result) if config set :ec2_project_tag, config['project_tag'] if config['project_tag']