diff --git a/cloudinit/analyze/__init__.py b/cloudinit/analyze/__init__.py index ea2144cb387..ae978ba7a01 100644 --- a/cloudinit/analyze/__init__.py +++ b/cloudinit/analyze/__init__.py @@ -115,7 +115,7 @@ def get_parser( return parser -def analyze_boot(name: str, args: argparse.Namespace) -> str: +def analyze_boot(name: str, args: argparse.Namespace) -> int: """Report a list of how long different boot operations took. For Example: @@ -199,7 +199,7 @@ def analyze_boot(name: str, args: argparse.Namespace) -> str: outfh.write(status_map[status_code].format(**kwargs)) clean_io(infh, outfh) - return status_code + return 1 if status_code == show.FAIL_CODE else 0 def analyze_blame(name, args: argparse.Namespace) -> None: diff --git a/tests/unittests/analyze/test_boot.py b/tests/unittests/analyze/test_boot.py index 6487790ddc6..9e89ef8867e 100644 --- a/tests/unittests/analyze/test_boot.py +++ b/tests/unittests/analyze/test_boot.py @@ -160,7 +160,7 @@ def test_container_no_ci_log_line(self, m_is_container, m_subp): finish_code = analyze_boot(name_default, args) self.remove_dummy_file(path, log_path) - assert FAIL_CODE == finish_code + assert 1 == finish_code @mock.patch("cloudinit.util.is_container", return_value=True) @mock.patch("cloudinit.subp.subp", return_value=("U=1000000", None)) @@ -190,7 +190,7 @@ def test_container_ci_log_line(self, m_is_container, m_subp, m_get, m_g): finish_code = analyze_boot(name_default, args) self.remove_dummy_file(path, log_path) - assert CONTAINER_CODE == finish_code + assert 0 == finish_code @mock.patch("cloudinit.analyze.show.SystemctlReader") @pytest.mark.parametrize(