Skip to content

Commit 3433372

Browse files
update snap.py
1 parent 0a78d11 commit 3433372

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/snap.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ def _raise_if_snap_installed_not_by_this_charm(*, unit: ops.Unit, model_uuid: st
3434
Assumes snap is installed
3535
"""
3636
snap_name = charm_refresh.snap_name()
37-
snap_unit_path = pathlib.Path(
37+
installed_by_unit = pathlib.Path(
3838
"/var/snap", snap_name, "common", "installed_by_mysql_router_charm_unit"
3939
)
4040

4141
if not (
42-
snap_unit_path.exists()
43-
and snap_unit_path.read_text() == _unique_unit_name(unit=unit, model_uuid=model_uuid)
42+
installed_by_unit.exists()
43+
and installed_by_unit.read_text() == _unique_unit_name(unit=unit, model_uuid=model_uuid)
4444
):
4545
# The snap could be in use by another charm (e.g. MySQL Server charm, a different MySQL
4646
# Router charm).
4747
logger.debug(
48-
f"{snap_unit_path.exists() and snap_unit_path.read_text()=} "
48+
f"{installed_by_unit.exists() and installed_by_unit.read_text()=} "
4949
f"{_unique_unit_name(unit=unit, model_uuid=model_uuid)=}"
5050
)
5151
logger.error(f"{snap_name} snap already installed on machine. Installation aborted")
@@ -136,7 +136,7 @@ class Snap(container.Container):
136136

137137
def __init__(self, *, unit_name: str) -> None:
138138
self._snap_name = charm_refresh.snap_name()
139-
self._snap_unit_path = pathlib.Path(
139+
self._installed_by_unit = pathlib.Path(
140140
"/var/snap", self._snap_name, "common", "installed_by_mysql_router_charm_unit"
141141
)
142142

@@ -269,8 +269,8 @@ def _set_retry_status(_) -> None:
269269
self._snap.ensure(state=snap_lib.SnapState.Present, revision=snap_revision)
270270
refresh.update_snap_revision()
271271
self._snap.hold()
272-
self._snap_unit_path.write_text(unique_unit_name)
273-
logger.debug(f"Wrote {unique_unit_name=} to {self._snap_unit_path.name=}")
272+
self._installed_by_unit.write_text(unique_unit_name)
273+
logger.debug(f"Wrote {unique_unit_name=} to {self._installed_by_unit.name=}")
274274
logger.info(f"Installed snap revision {repr(snap_revision)}")
275275

276276
def refresh(

0 commit comments

Comments
 (0)