@@ -34,18 +34,18 @@ def _raise_if_snap_installed_not_by_this_charm(*, unit: ops.Unit, model_uuid: st
34
34
Assumes snap is installed
35
35
"""
36
36
snap_name = charm_refresh .snap_name ()
37
- snap_unit_path = pathlib .Path (
37
+ installed_by_unit = pathlib .Path (
38
38
"/var/snap" , snap_name , "common" , "installed_by_mysql_router_charm_unit"
39
39
)
40
40
41
41
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 )
44
44
):
45
45
# The snap could be in use by another charm (e.g. MySQL Server charm, a different MySQL
46
46
# Router charm).
47
47
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 ()= } "
49
49
f"{ _unique_unit_name (unit = unit , model_uuid = model_uuid )= } "
50
50
)
51
51
logger .error (f"{ snap_name } snap already installed on machine. Installation aborted" )
@@ -136,7 +136,7 @@ class Snap(container.Container):
136
136
137
137
def __init__ (self , * , unit_name : str ) -> None :
138
138
self ._snap_name = charm_refresh .snap_name ()
139
- self ._snap_unit_path = pathlib .Path (
139
+ self ._installed_by_unit = pathlib .Path (
140
140
"/var/snap" , self ._snap_name , "common" , "installed_by_mysql_router_charm_unit"
141
141
)
142
142
@@ -269,8 +269,8 @@ def _set_retry_status(_) -> None:
269
269
self ._snap .ensure (state = snap_lib .SnapState .Present , revision = snap_revision )
270
270
refresh .update_snap_revision ()
271
271
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 = } " )
274
274
logger .info (f"Installed snap revision { repr (snap_revision )} " )
275
275
276
276
def refresh (
0 commit comments