From 11d98a54724f35b930b8b60deadee3ce40ac90c1 Mon Sep 17 00:00:00 2001 From: Eduardo Hattori Date: Fri, 20 May 2022 16:00:58 -0300 Subject: [PATCH 1/4] refact: remove validation Aws.config --- bin/pipefymessage | 8 ++++++++ lib/pipefy_message/providers/aws_client/aws_client.rb | 3 --- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/pipefymessage b/bin/pipefymessage index 0346ea4..05ff3cc 100755 --- a/bin/pipefymessage +++ b/bin/pipefymessage @@ -13,8 +13,10 @@ module PipefyMessage desc "start", "Starts PipefyMessage consumer" method_option :worker, aliases: "-w", type: :string, desc: "Worker to load" method_option :rails, aliases: "-R", type: :boolean, desc: "Load Rails", default: false + method_option :pidfile, aliases: '-P', type: :string, desc: 'Path to pidfile' def start PipefyMessage::Runner.instance.initialize_rails if options[:rails] + PipefyMessage::Runner.instance.write_pid(options) if options[:pidfile] PipefyMessage::Runner.instance.run(options[:worker]) if options[:worker] end end @@ -35,6 +37,12 @@ module PipefyMessage end end + def write_pid(options) + return unless (path = options[:pidfile]) + + File.open(path, 'w') { |f| f.puts(Process.pid) } + end + def run(worker) worker.constantize.process_message end diff --git a/lib/pipefy_message/providers/aws_client/aws_client.rb b/lib/pipefy_message/providers/aws_client/aws_client.rb index 70f045c..9c462c6 100644 --- a/lib/pipefy_message/providers/aws_client/aws_client.rb +++ b/lib/pipefy_message/providers/aws_client/aws_client.rb @@ -14,10 +14,7 @@ module AwsClient ## # Sets up AWS options the first time an AWS service is used. def self.aws_setup - return unless Aws.config.empty? - logger.info({ message_text: "AWS configurations set" }) - Aws.config.update(retrieve_config) end From 5c6da6abcee9d94b6a9752d1b4317533346f2a46 Mon Sep 17 00:00:00 2001 From: Eduardo Hattori Date: Fri, 20 May 2022 16:06:25 -0300 Subject: [PATCH 2/4] fix: rubocop issues --- bin/pipefymessage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/pipefymessage b/bin/pipefymessage index 05ff3cc..fa7b636 100755 --- a/bin/pipefymessage +++ b/bin/pipefymessage @@ -13,7 +13,7 @@ module PipefyMessage desc "start", "Starts PipefyMessage consumer" method_option :worker, aliases: "-w", type: :string, desc: "Worker to load" method_option :rails, aliases: "-R", type: :boolean, desc: "Load Rails", default: false - method_option :pidfile, aliases: '-P', type: :string, desc: 'Path to pidfile' + method_option :pidfile, aliases: "-P", type: :string, desc: "Path to pidfile" def start PipefyMessage::Runner.instance.initialize_rails if options[:rails] PipefyMessage::Runner.instance.write_pid(options) if options[:pidfile] From b27284acf42f59b49258ed043a58a5827bab655b Mon Sep 17 00:00:00 2001 From: Eduardo Hattori Date: Fri, 20 May 2022 16:11:49 -0300 Subject: [PATCH 3/4] fix: rubocop issues --- bin/pipefymessage | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/pipefymessage b/bin/pipefymessage index fa7b636..4bbc81f 100755 --- a/bin/pipefymessage +++ b/bin/pipefymessage @@ -13,7 +13,7 @@ module PipefyMessage desc "start", "Starts PipefyMessage consumer" method_option :worker, aliases: "-w", type: :string, desc: "Worker to load" method_option :rails, aliases: "-R", type: :boolean, desc: "Load Rails", default: false - method_option :pidfile, aliases: "-P", type: :string, desc: "Path to pidfile" + method_option :pidfile, aliases: "-P", type: :string, desc: "Path to pidfile" def start PipefyMessage::Runner.instance.initialize_rails if options[:rails] PipefyMessage::Runner.instance.write_pid(options) if options[:pidfile] @@ -40,7 +40,7 @@ module PipefyMessage def write_pid(options) return unless (path = options[:pidfile]) - File.open(path, 'w') { |f| f.puts(Process.pid) } + File.open(path, "w") { |f| f.puts(Process.pid) } end def run(worker) From 9d04a54143819341d993809bdb70b70c068ef5ab Mon Sep 17 00:00:00 2001 From: Eduardo Hattori Date: Fri, 20 May 2022 16:16:21 -0300 Subject: [PATCH 4/4] fix: tests about config mmore the once --- spec/providers/aws/aws_client_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/providers/aws/aws_client_spec.rb b/spec/providers/aws/aws_client_spec.rb index b44a1af..4017f2e 100644 --- a/spec/providers/aws/aws_client_spec.rb +++ b/spec/providers/aws/aws_client_spec.rb @@ -48,6 +48,7 @@ def initialize TestClient.new ENV["AWS_CLI_STUB_RESPONSE"] = "false" + ENV["ENABLE_AWS_CLIENT_CONFIG"] = "false" TestClient.new expect(Aws.config).to eq aws_opts