Skip to content

Commit

Permalink
support --no-destroy-on-error in up(), closes pycontribs#122
Browse files Browse the repository at this point in the history
  • Loading branch information
eighthave committed Jul 12, 2022
1 parent 3576c0e commit c4f6589
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/vagrant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ def up(
provision=None,
provision_with=None,
stream_output=False,
destroy_on_error=True,
):
"""
Invoke `vagrant up` to start a box or boxes, possibly streaming the
Expand All @@ -330,6 +331,8 @@ def up(
subprocess might hang. if False, None is returned and the command
is run to completion without streaming the output. Defaults to
False.
destroy_on_error: if True, the newly created will be destroyed if there
was any error in the provisioning.
Note: If provision and no_provision are not None, no_provision will be
ignored.
returns: None or a generator yielding lines of output.
Expand All @@ -350,7 +353,10 @@ def up(
if provision
else "--no-provision"
)

if destroy_on_error:
destroy_on_error_arg = "--destroy-on-error"
else:
destroy_on_error_arg = "--no-destroy-on-error"
args = [
"up",
vm_name,
Expand All @@ -359,6 +365,7 @@ def up(
provider_arg,
prov_with_arg,
providers_arg,
destroy_on_error_arg,
]
if stream_output:
generator = self._stream_vagrant_command(args)
Expand Down

0 comments on commit c4f6589

Please sign in to comment.