Merge lp:~james-page/juju-deployer/fixup-to-for-strings into lp:juju-deployer/darwin

Proposed by James Page
Status: Merged
Approved by: Kapil Thangavelu
Approved revision: 118
Merge reported by: Kapil Thangavelu
Merged at revision: not available
Proposed branch: lp:~james-page/juju-deployer/fixup-to-for-strings
Merge into: lp:juju-deployer/darwin
Diff against target: 21 lines (+2/-2)
1 file modified
deployer/env/base.py (+2/-2)
To merge this branch: bzr merge lp:~james-page/juju-deployer/fixup-to-for-strings
Reviewer Review Type Date Requested Status
Kapil Thangavelu Approve
Adam Gandelman Pending
Review via email: mp+188296@code.launchpad.net

This proposal supersedes a proposal from 2013-09-30.

Description of the change

Support use of string based machine identifiers in force-machine and
terminate-machine calls

To post a comment you must log in.
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

merged with minor change around the condition as it wouldn't work with mid = '0'. instead two separate clauses of the condition one with (mid.isdigit() and int(mid) == 0) to preserve original intent/behavior.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'deployer/env/base.py'
--- deployer/env/base.py 2013-09-13 13:36:22 +0000
+++ deployer/env/base.py 2013-09-30 10:52:29 +0000
@@ -82,7 +82,7 @@
82 repo = "."82 repo = "."
83 params.extend(["--repository=%s" % repo])83 params.extend(["--repository=%s" % repo])
84 if force_machine is not None:84 if force_machine is not None:
85 params.extend(["--to=%d" % force_machine])85 params.extend(["--to=%s" % force_machine])
8686
87 params.extend([charm_url, name])87 params.extend([charm_url, name])
88 self._check_call(88 self._check_call(
@@ -96,7 +96,7 @@
96 delete the machine (ie units have finished executing stop hooks and are96 delete the machine (ie units have finished executing stop hooks and are
97 removed)97 removed)
98 """98 """
99 if int(mid) == 0:99 if isinstance(mid, int) and int(mid) == 0:
100 raise RuntimeError("Can't terminate machine 0")100 raise RuntimeError("Can't terminate machine 0")
101 params = self._named_env(["juju", "terminate-machine"])101 params = self._named_env(["juju", "terminate-machine"])
102 params.append(mid)102 params.append(mid)

Subscribers

People subscribed via source and target branches

to all changes: