From 7df86a9efab2d4b8e5353319fe6c03f6c23c8021 Mon Sep 17 00:00:00 2001 From: Olivier ORAND Date: Fri, 31 Jan 2020 17:35:51 +0100 Subject: [PATCH] task(bosh-delete-apply): ignore errors on bosh delete deployment --- lib/tasks/bosh/delete_deployment.rb | 2 +- spec/lib/tasks/bosh/delete_deployment_spec.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/tasks/bosh/delete_deployment.rb b/lib/tasks/bosh/delete_deployment.rb index a340a9260..cd28419ba 100644 --- a/lib/tasks/bosh/delete_deployment.rb +++ b/lib/tasks/bosh/delete_deployment.rb @@ -3,7 +3,7 @@ module Bosh # holds bosh delete deployment command class DeleteDeployment < Executor def execute(name) - bosh_command = "bosh delete-deployment --json --non-interactive -d #{name}" + bosh_command = "bosh delete-deployment --json --non-interactive -d #{name} --force" self.class.run_command(bosh_command) end end diff --git a/spec/lib/tasks/bosh/delete_deployment_spec.rb b/spec/lib/tasks/bosh/delete_deployment_spec.rb index 163210c25..bd1a2f762 100644 --- a/spec/lib/tasks/bosh/delete_deployment_spec.rb +++ b/spec/lib/tasks/bosh/delete_deployment_spec.rb @@ -43,14 +43,14 @@ let(:expected_result) { delete_deployment_response } before do - allow(Open3).to receive(:capture3).with(cmd_env, "bosh delete-deployment --json --non-interactive -d #{my_deployment_name}"). + allow(Open3).to receive(:capture3).with(cmd_env, "bosh delete-deployment --json --non-interactive -d #{my_deployment_name} --force"). and_return([delete_deployment_json_response, nil, process_status_zero]) end it "executes a bosh command" do expect(command_output).to match(expected_result) - expect(Open3).to have_received(:capture3).with(cmd_env, "bosh delete-deployment --json --non-interactive -d #{my_deployment_name}") + expect(Open3).to have_received(:capture3).with(cmd_env, "bosh delete-deployment --json --non-interactive -d #{my_deployment_name} --force") end end @@ -59,7 +59,7 @@ let(:stdout) { "o" } before do - allow(Open3).to receive(:capture3).with(cmd_env, "bosh delete-deployment --json --non-interactive -d #{my_deployment_name}").once. + allow(Open3).to receive(:capture3).with(cmd_env, "bosh delete-deployment --json --non-interactive -d #{my_deployment_name} --force").once. and_return([stdout, stderr, process_status_one]) end