Skip to content

Deduplicate hookutil #715

@mattculler

Description

@mattculler

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions