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

[DPE-5711] Add warnings to destructive actions #336

Merged
merged 4 commits into from
Dec 9, 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
1 change: 1 addition & 0 deletions src/kubernetes_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ def determine_partition() -> int:
action_event.fail(message)
return
if force:
logger.warning(f"Resume upgrade action ran with {force=}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logger.warning(f"Resume upgrade action ran with {force=}")
logger.warning(f"Resume upgrade action ran with force=True")

nit (#336 (comment))

technically end result is the same, but think we should avoid using repr syntax (e.g. for type str) when the output is intended for the user instead of developer, since repr syntax does not line up with juju cli syntax

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see many usages of this syntax throughout the repo (see GitHub search). Keeping it for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those usages are when the output is intended for developer, and to show the developer what the value of a python variable is

those usages are not for displaying what the user inputs of a juju action were

# If a unit was unhealthy and the upgrade was forced, only the next unit will
# upgrade. As long as 1 or more units are unhealthy, the upgrade will need to be
# forced for each unit.
Expand Down
8 changes: 4 additions & 4 deletions src/workload.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ def _disable_tls(self) -> None:

def _disable_router(self) -> None:
"""Disable router and clean up corresponding router files."""
logger.debug("Disabling MySQL Router service")
logger.info("Disabling MySQL Router service")
sinclert-canonical marked this conversation as resolved.
Show resolved Hide resolved
self._container.update_mysql_router_service(enabled=False)
self._logrotate.disable()
self._container.router_config_directory.rmtree()
self._container.router_config_directory.mkdir()
self._router_data_directory.rmtree()
self._router_data_directory.mkdir()
logger.debug("Disabled MySQL Router service")
logger.info("Disabled MySQL Router service")

def reconcile(
self,
Expand Down Expand Up @@ -327,7 +327,7 @@ def _restart(self, *, event, tls: bool) -> None:

def _enable_router(self, *, event, tls: bool, unit_name: str) -> None:
"""Enable router after setting up all the necessary prerequisites."""
logger.debug("Enabling MySQL Router service")
logger.info("Enabling MySQL Router service")
self._cleanup_after_upgrade_or_potential_container_restart()
# create an empty credentials file, if the file does not exist
self._container.create_router_rest_api_credentials_file()
Expand All @@ -337,7 +337,7 @@ def _enable_router(self, *, event, tls: bool, unit_name: str) -> None:
)
self._container.update_mysql_router_service(enabled=True, tls=tls)
self._logrotate.enable()
logger.debug("Enabled MySQL Router service")
logger.info("Enabled MySQL Router service")
self._charm.wait_until_mysql_router_ready(event=event)

def _enable_exporter(
Expand Down
Loading