Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
holmanb committed May 3, 2024
1 parent 4ac4a40 commit 5564cdf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
14 changes: 11 additions & 3 deletions cloudinit/cmd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@
"once": PER_ONCE,
}

# https://cloudinit.readthedocs.io/en/latest/explanation/boot.html
STAGE_NAME = {
"init-local": "Local Stage",
"init": "Network Stage",
"modules-config": "Config Stage",
"modules-final": "Final Stage",
}

LOG = logging.getLogger(__name__)


Expand Down Expand Up @@ -749,7 +757,7 @@ def status_wrapper(name, args):

nullstatus = {
"errors": [],
"recoverable_errors": [],
"recoverable_errors": {},
"start": None,
"finished": None,
}
Expand Down Expand Up @@ -780,8 +788,8 @@ def status_wrapper(name, args):
if v1[mode]["start"] and not v1[mode]["finished"]:
# This stage was restarted, which isn't expected.
LOG.warning(
"Unexpected start time for stage %s. " "Was this stage restarted?",
mode,
"Unexpected start time found for %s. " "Was this stage restarted?",
STAGE_NAME[mode],
)

v1[mode]["start"] = float(util.uptime())
Expand Down
11 changes: 5 additions & 6 deletions tests/unittests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,25 +498,25 @@ def test_status_wrapper_signal_warnings(
),
"init": {
"errors": [],
"recoverable_errors": [],
"recoverable_errors": {},
"start": 124.567,
"finished": None,
},
"init-local": {
"errors": [],
"recoverable_errors": [],
"recoverable_errors": {},
"start": 100.0,
"finished": 100.00001,
},
"modules-config": {
"errors": [],
"recoverable_errors": [],
"recoverable_errors": {},
"start": None,
"finished": None,
},
"modules-final": {
"errors": [],
"recoverable_errors": [],
"recoverable_errors": {},
"start": None,
"finished": None,
},
Expand All @@ -540,8 +540,7 @@ def test_status_wrapper_signal_warnings(

# assert that the status shows recoverable errors
assert (
"[init] Unexpected value found in status.json. "
"Was this stage restarted?"
'Unexpected start time found for Network Stage. Was this stage restarted?'
in m_json.call_args[0][1]["v1"]["init"]["recoverable_errors"][
"WARNING"
]
Expand Down

0 comments on commit 5564cdf

Please sign in to comment.