craft_providers.multipass.multipass_provider module

Multipass Provider class.

class craft_providers.multipass.multipass_provider.MultipassProvider(instance=<craft_providers.multipass.multipass.Multipass object>)[source]

Bases: craft_providers.provider.Provider

Multipass build environment provider.

This class is not stable and is likely to change. This class will be stable and recommended for use in the release of craft-providers 2.0.

Parameters
  • multipass – Optional Multipass client to use.

  • instance (Multipass) –

create_environment(*, instance_name)[source]

Create a bare environment for specified base.

No initializing, launching, or cleaning up of the environment occurs.

Parameters
  • name – Name of the instance.

  • instance_name (str) –

Return type

Executor

classmethod ensure_provider_is_available()[source]

Ensure provider is available, prompting the user to install it if required.

Raises

MultipassError – if provider is not available.

Return type

None

classmethod is_provider_installed()[source]

Check if provider is installed.

Return type

bool

Returns

True if installed.

launched_environment(*, project_name, project_path, base_configuration, build_base, instance_name)[source]

Configure and launch environment for specified base.

When this method loses context, all directories are unmounted and the environment is stopped. For more control of environment setup and teardown, use create_environment() instead.

Parameters
  • project_name (str) – Name of the project.

  • project_path (Path) – Path to project.

  • base_configuration (Base) – Base configuration to apply to instance.

  • build_base (str) – Base to build from.

  • instance_name (str) – Name of the instance to launch.

Return type

Generator[Executor, None, None]