Merge ~asbalderson/juju-wait:maintain-default-behavior into juju-wait:master

Proposed by Alexander Balderson
Status: Merged
Merged at revision: e83dfe3d132fed7fce694bf43787cf02e8d60864
Proposed branch: ~asbalderson/juju-wait:maintain-default-behavior
Merge into: juju-wait:master
Diff against target: 55 lines (+10/-8)
1 file modified
juju_wait/__init__.py (+10/-8)
Reviewer Review Type Date Requested Status
Stuart Bishop (community) Approve
Jason Hobbs (community) Approve
Review via email: mp+378306@code.launchpad.net

Commit message

Maintain orignal success regardless of machine status

Set the defaults for pending and error timeout to 0, and add
fucntionality so that 0 timeout does not set ready to False.

To post a comment you must log in.
Revision history for this message
Jason Hobbs (jason-hobbs) wrote :

+1. Some background, in our testing, this flagged a failure on a machine that didn't really have any issues other than juju leaving it in 'down' for a while on its way up.

review: Approve
Revision history for this message
Stuart Bishop (stub) wrote :

Ta. The new feature should have been backwards compatible to begin with. Bugfix release coming shortly.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/juju_wait/__init__.py b/juju_wait/__init__.py
2index d40a59b..f88a463 100755
3--- a/juju_wait/__init__.py
4+++ b/juju_wait/__init__.py
5@@ -270,7 +270,7 @@ def wait_cmd(args=sys.argv[1:]):
6 dest="machine_error_timeout",
7 type=int,
8 action="store",
9- default=300,
10+ default=0,
11 help="Time for a machine to be in a bad state before exiting (seconds).",
12 )
13 parser.add_argument(
14@@ -278,7 +278,7 @@ def wait_cmd(args=sys.argv[1:]):
15 dest="machine_pending_timeout",
16 type=int,
17 action="store",
18- default=3600,
19+ default=0,
20 help="Time for a machine to be in a pending state before exiting (seconds).",
21 )
22 parser.add_argument("--version", default=False, action="store_true")
23@@ -367,8 +367,8 @@ def wait(
24 max_wait=None,
25 retry_errors=0,
26 exclude=None,
27- machine_error_timeout=300,
28- machine_pending_timeout=3600,
29+ machine_error_timeout=0,
30+ machine_pending_timeout=0,
31 machine_exclude=None,
32 ):
33 # Note that wait_for_workload is only useful as a workaround for
34@@ -586,15 +586,17 @@ def wait(
35 logging.debug("Ignoring machine {} because it is excluded".format(machine))
36 continue
37 if state.state in MACHINE_ERROR_STATES:
38- ready = False
39 logging.debug("Machine {} is in {}".format(machine, state.state))
40- if loop_starttime - state.time.timestamp() > machine_error_timeout:
41+ if machine_error_timeout > 0:
42+ ready = False
43+ if machine_error_timeout > 0 and loop_starttime - state.time.timestamp() > machine_error_timeout:
44 minutes = round((loop_starttime - state.time.timestamp()) / 60)
45 logging.error("Machine {} is in {} for {} minutes.".format(machine, state.state, minutes))
46 raise JujuWaitException(1)
47 if state.state in MACHINE_PENDING_STATES:
48- ready = False
49- if loop_starttime - state.time.timestamp() > machine_pending_timeout:
50+ if machine_pending_timeout > 0:
51+ ready = False
52+ if machine_pending_timeout > 0 and loop_starttime - state.time.timestamp() > machine_pending_timeout:
53 minutes = round((loop_starttime - state.time.timestamp()) / 60)
54 logging.error("Machine {} has been pending for {} minutes".format(machine, minutes))
55 raise JujuWaitException(1)

Subscribers

People subscribed via source and target branches

to all changes: