Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix finishing indicator if HighestReleaseAchieved #205

Merged
merged 4 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions cou/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ def get_log_level(quiet: bool = False, verbosity: int = 0) -> str:
:return: Log level.
:rtype: str
"""
if quiet:
return "CRITICAL"
return VerbosityLevel(verbosity).name
return "CRITICAL" if quiet else VerbosityLevel(verbosity).name


async def continue_upgrade() -> bool:
Expand Down Expand Up @@ -220,8 +218,8 @@ def entrypoint() -> None:
loop = asyncio.get_event_loop()
loop.run_until_complete(_run_command(args))
except HighestReleaseAchieved as exc:
progress_indicator.succeed()
agileshaw marked this conversation as resolved.
Show resolved Hide resolved
print(exc)
sys.exit(0)
agileshaw marked this conversation as resolved.
Show resolved Hide resolved
except TimeoutException:
progress_indicator.fail()
print("The connection was lost. Check your connection or increase the timeout.")
Expand Down
2 changes: 1 addition & 1 deletion cou/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def setup_logging(log_level: str = "INFO") -> None:
root_logger.addHandler(log_file_handler)
root_logger.addHandler(console_handler)

progress_indicator.stop_and_persist(text=f"Logs of this execution can be found at {file_name}")
progress_indicator.stop_and_persist(text=f"Full execution log: '{file_name}'")


def filter_debug_logs(record: logging.LogRecord) -> bool:
Expand Down
6 changes: 3 additions & 3 deletions cou/steps/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ def determine_upgrade_target(
# Check if the release is the "last" supported by the series
if str(current_os_release) == LTS_TO_OS_RELEASE[current_series][-1]:
raise HighestReleaseAchieved(
f"The cloud is already at the latest OpenStack release '{current_os_release}' "
f"compatible with series '{current_series}', and COU does not support series "
"upgrade. Please manually upgrade series and run COU again."
f"No upgrades available for OpenStack {str(current_os_release).capitalize()} on "
f"Ubuntu {current_series.capitalize()}.\nNewer OpenStack releases may be available "
"after upgrading to a later Ubuntu series."
)

# get the next release as the target from the current cloud os release
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,9 @@ def test_entrypoint_highest_release(mock_run_command, mock_indicator):
"""Test TimeoutException exception during entrypoint execution."""
mock_run_command.side_effect = HighestReleaseAchieved

with pytest.raises(SystemExit, match="0"):
cli.entrypoint()
cli.entrypoint()

mock_indicator.succeed.assert_called_once_with()
mock_indicator.stop.assert_called_once_with()
agileshaw marked this conversation as resolved.
Show resolved Hide resolved


Expand Down