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

Deduplicate hookutil #715

Open
mattculler opened this issue Jan 10, 2025 · 1 comment
Open

Deduplicate hookutil #715

mattculler opened this issue Jan 10, 2025 · 1 comment
Assignees
Labels
triaged We will be doing this

Comments

@mattculler
Copy link
Contributor

mattculler commented Jan 10, 2025

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 #710 (review)

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.)

@mattculler mattculler self-assigned this Jan 10, 2025
@mattculler mattculler added the triaged We will be doing this label Jan 10, 2025
Copy link

Thank you for reporting your feedback to us!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-3891.

This message was autogenerated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged We will be doing this
Projects
None yet
Development

No branches or pull requests

1 participant