← Back to issue list

Deduplicate hookutil

View original Github issue

Metadata

Project
craft-providers
Number
#715
Type
issue
State
closed
Author
mattculler
Labels
Type: Enhancement
Created
Updated
Closed

Current evaluation

Enhancement request to deduplicate hookutil against craft-providers' own LXD code. Delivered by merged PR #1006 (commit f366c2f): hookutil now uses craft_providers.lxd.LXC and exposes BASE_INSTANCE_START_STRING.

Resolution: closed resolved

Reason: Merged PR canonical/craft-providers#1006 (commit f366c2f, 'refactor: deduplicate hookutil') closed the issue. hookutil.py now imports LXC, LXDError and is_installed from craft_providers.lxd and defines BASE_INSTANCE_START_STRING, replacing the hand-rolled delete_all_images/delete_project and related helpers.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Now that `hookutil` is part of `craft-providers`, make use of existing lxd and other code - @mr-cal gave a great guide here: _Originally posted by @mr-cal in https://github.com/canonical/craft-providers/pull/710#pullrequestreview-2540568615_ To sum up: - `lxc.delete_all_images()` and `lxc.delete_project()` can be replaced with `craft_providers.lxc.project.purge()` - Re: `def lxc`: Can this be replaced with craft_providers.lxd.lxc.LXC? That would let you simplify or entirely drop some of these functions in hookutil: def _check_project_exists() def delete_instance() def _delete_image() def _list_images() Also: - Make the base instance start string (`base-instance`) accessible for hookutil. (The full compatibility tag can't come from craft-providers proper because you need a fully instantiated application in order to get it. Implementing a solution that amounts to the next best thing in the origin PR.)

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Enhancement request to deduplicate hookutil against craft-providers' own LXD code. Delivered by merged PR #1006 (commit f366c2f): hookutil now uses craft_providers.lxd.LXC and exposes BASE_INSTANCE_START_STRING.
stealth/space-bunny-alpha — closed resolved Resolved by merged PR canonical/craft-providers#1006 in commit f366c2f, replacing hookutil's ad hoc LXC wrapper with craft_providers.lxd.LXC.
qwen/qwen3.8-27b — — Closed without a public fix or merge; the hookutil deduplication enhancement was tracked internally as CRAFT-3891.
qwen/qwen3.6-35b-a3b
Staleness: 78
Complexity: 32
Confidence: 72
Support Request: 5
keep open Refactoring hookutil to replace local functions with existing craft-providers utilities like lxc.project.purge() and LXC wrapper. Currently awaiting implementation after a Jira sync comment.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 20
Confidence: 75
Support Request: 0
needs triage Refactoring task to deduplicate hookutil by leveraging craft-providers utilities. Open for ~18 months with no maintainer assignment or recent discussion.

Update history

Date Change
closed

Related work

  • Likely Fixed By: canonical/craft-providers#1006 (confidence 97%)

    Merged PR titled 'refactor: deduplicate hookutil', commit f366c2f; described as fixing #715.

  • Related To: canonical/craft-providers#710 (confidence 80%)

    Original 'feat: upstream snap hooks' PR whose review by @mr-cal spawned this issue; commit 5bbaf39.

Related issues

Issue Project State Summary Similarity
#1006 refactor: deduplicate hookutil craft-providers merged Merged PR #1006 (f366c2f) replaced hookutil's custom LXC wrapper with craft_providers.lxd.LXC, translated LXD failures to HookError, and resolved #715.
83%