Skip to content

Commit 7fd4e24

Browse files
committed
fix: use the superior is-installed check from c-prov proper
1 parent d66fc2d commit 7fd4e24

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

craft_providers/hookutil.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from typing_extensions import Self
3434

3535
from craft_providers import Base
36+
from craft_providers import lxd
3637

3738
_BASE_INSTANCE_START_STRING = "base-instance"
3839
_CURRENT_COMPATIBILITY_TAG_REGEX = re.compile(
@@ -102,12 +103,8 @@ def _check_has_lxd(self) -> None:
102103
purposes of the configure and remove hooks we don't want to install LXD just to
103104
check that it has no stale images.
104105
"""
105-
try:
106-
subprocess.run(
107-
["snap", "list", "lxd"], check=True, text=True, capture_output=True
108-
)
109-
except subprocess.CalledProcessError as e:
110-
raise HookError("LXD is not installed.") from e
106+
if not lxd.is_installed():
107+
raise HookError("LXD is not installed.")
111108

112109
def _check_project_exists(self) -> None:
113110
"""Raise HookError if lxc doesn't know about this app."""

0 commit comments

Comments
 (0)