From e22cf71af0162da53d99cbbbebb7c8a62e9edda6 Mon Sep 17 00:00:00 2001 From: MarkusSiebert Date: Fri, 1 Feb 2019 14:48:51 +0100 Subject: [PATCH 1/4] bugfix of exit codes for failed stack commands --- lib/stack_master/cli.rb | 3 ++- lib/stack_master/commands/apply.rb | 2 +- lib/stack_master/commands/delete.rb | 2 +- lib/stack_master/version.rb | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/stack_master/cli.rb b/lib/stack_master/cli.rb index 0a95ced9..5f2e0c74 100644 --- a/lib/stack_master/cli.rb +++ b/lib/stack_master/cli.rb @@ -193,7 +193,7 @@ def execute! stack_name = Utils.underscore_to_hyphen(args[1]) StackMaster.cloud_formation_driver.set_region(region) - StackMaster::Commands::Delete.perform(region, stack_name) + StackMaster::Commands::Delete.perform(region, stack_name).success? end end @@ -230,6 +230,7 @@ def execute_stacks_command(command, args, options) end # Return success/failure + puts "Command Resulst #{command_results}" command_results.all? end end diff --git a/lib/stack_master/commands/apply.rb b/lib/stack_master/commands/apply.rb index 932eee62..33f77e77 100644 --- a/lib/stack_master/commands/apply.rb +++ b/lib/stack_master/commands/apply.rb @@ -212,7 +212,7 @@ def ensure_valid_parameters! @stack_definition.parameter_files.each do |parameter_file| StackMaster.stderr.puts " - #{parameter_file}" end - halt! + failed! end end diff --git a/lib/stack_master/commands/delete.rb b/lib/stack_master/commands/delete.rb index 415db334..7ae1b06b 100644 --- a/lib/stack_master/commands/delete.rb +++ b/lib/stack_master/commands/delete.rb @@ -12,7 +12,7 @@ def initialize(region, stack_name) def perform - return unless check_exists + failed! unless check_exists unless ask?("Really delete stack #{@stack_name} (y/n)? ") StackMaster.stdout.puts "Stack update aborted" diff --git a/lib/stack_master/version.rb b/lib/stack_master/version.rb index 581ac580..ac32bd6c 100644 --- a/lib/stack_master/version.rb +++ b/lib/stack_master/version.rb @@ -1,3 +1,3 @@ module StackMaster - VERSION = "1.12.0" + VERSION = "1.13.0" end From 9f75fa1822793836de5bb9e29fca3008e14c2e9e Mon Sep 17 00:00:00 2001 From: MarkusSiebert Date: Fri, 1 Feb 2019 14:52:10 +0100 Subject: [PATCH 2/4] reverted version number --- lib/stack_master/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/stack_master/version.rb b/lib/stack_master/version.rb index ac32bd6c..581ac580 100644 --- a/lib/stack_master/version.rb +++ b/lib/stack_master/version.rb @@ -1,3 +1,3 @@ module StackMaster - VERSION = "1.13.0" + VERSION = "1.12.0" end From 8ba5589413d121f95f05349aa139c5543149f03d Mon Sep 17 00:00:00 2001 From: MarkusSiebert Date: Fri, 1 Feb 2019 15:11:20 +0100 Subject: [PATCH 3/4] changed validate cucumber test --- features/validate.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/validate.feature b/features/validate.feature index 7da935d7..9a59bb73 100644 --- a/features/validate.feature +++ b/features/validate.feature @@ -43,4 +43,4 @@ Feature: Validate command Scenario: Validate unsuccessfully Given I stub CloudFormation validate calls to fail validation with message "Blah" And I run `stack_master validate us-east-1 stack1` - Then the output should contain "stack1: invalid. Blah" + Then the exit status should be 1 From b7074544832025a7271ecae08fc2518456f76dd3 Mon Sep 17 00:00:00 2001 From: MarkusSiebert Date: Fri, 1 Feb 2019 15:27:54 +0100 Subject: [PATCH 4/4] reverted cucumber test for validate --- features/validate.feature | 2 +- lib/stack_master/cli.rb | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/features/validate.feature b/features/validate.feature index 9a59bb73..7da935d7 100644 --- a/features/validate.feature +++ b/features/validate.feature @@ -43,4 +43,4 @@ Feature: Validate command Scenario: Validate unsuccessfully Given I stub CloudFormation validate calls to fail validation with message "Blah" And I run `stack_master validate us-east-1 stack1` - Then the exit status should be 1 + Then the output should contain "stack1: invalid. Blah" diff --git a/lib/stack_master/cli.rb b/lib/stack_master/cli.rb index 5f2e0c74..4cbad343 100644 --- a/lib/stack_master/cli.rb +++ b/lib/stack_master/cli.rb @@ -230,7 +230,6 @@ def execute_stacks_command(command, args, options) end # Return success/failure - puts "Command Resulst #{command_results}" command_results.all? end end