Skip to content

Commit

Permalink
Let license errors raise without trying to cleanup sandbox
Browse files Browse the repository at this point in the history
Before this change if the license acceptance failed and raised an
exception the 'cleanup_sandbox' was called in an ensure. But the
sandbox would not have been created yet so it would fail with an error
like:

Failed to complete #converge action: [Sandbox directory has not yet been
created. Please run Kitchen::Provisioner::ChefGithub#create_sandox
before trying to access the path.]

Signed-off-by: tyler-ball <[email protected]>
  • Loading branch information
tyler-ball committed May 13, 2019
1 parent a5013d4 commit c932286
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 7 deletions.
1 change: 1 addition & 0 deletions lib/kitchen/instance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ def converge_action
if legacy_ssh_base_driver?
legacy_ssh_base_converge(state)
else
provisioner.check_license
provisioner.call(state)
end
end
Expand Down
1 change: 0 additions & 1 deletion lib/kitchen/provisioner/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def initialize(config = {})
# @raise [ActionFailed] if the action could not be completed
# rubocop:disable Metrics/AbcSize
def call(state)
check_license
create_sandbox
sandbox_dirs = Util.list_directory(sandbox_path)

Expand Down
1 change: 1 addition & 0 deletions spec/kitchen/instance_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ def platform(name = "platform")
describe "with no state" do
it "calls Driver#create and Provisioner#call with empty state hash" do
driver.expects(:create).with({})
provisioner.expects(:check_license)
provisioner.expects(:call)
.with { |state| state[:last_action] == "create" }

Expand Down
6 changes: 0 additions & 6 deletions spec/kitchen/provisioner/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,6 @@ def sandbox_path
FakeFS::FileSystem.clear
end

it "checks the license" do
provisioner.expects(:check_license)

cmd
end

it "creates the sandbox" do
provisioner.expects(:create_sandbox)

Expand Down

0 comments on commit c932286

Please sign in to comment.