Skip to content

Add Vagrant box commands #33

Description

@andrew

Version: git-pkgs/managers current main at 241e284.

Trying to build Vagrant box commands after registering the embedded definitions currently returns unknown manager: vagrant:

_, err := tr.BuildCommand("vagrant", "add", managers.CommandInput{
	Args: map[string]string{"package": "hashicorp/bionic64", "version": "1.0.282"},
})

Add a vagrant definition for box management. Detect Vagrantfile as the manifest; the upstream generated Vagrantfile template shows the box name, version, and optional catalog URL fields. Include definitions/vagrant.yaml, captured version and box command help under references/vagrant, translator tests, and suitable version coverage as described in the new manager contribution guide.

Map the operations to Vagrant's box subcommands:

  • add should build vagrant box add. The descriptor may be a namespaced box, catalog URL, local catalog JSON file, or local box file. The command implementation accepts an optional name plus URL, --box-version, --provider, --architecture, --checksum, --checksum-type, --clean, and --force.
  • remove should build vagrant box remove NAME and expose version, provider, architecture, all-version, all-provider, all-architecture, and force selectors from the remove command. Do not enable --force by default.
  • list should use vagrant box list --machine-readable. The implementation emits separate name, provider, version, and architecture fields.
  • outdated should use vagrant box outdated --global to check the installed collection without requiring a project machine. Map update to vagrant box update --box NAME, with provider, architecture, and force options. The upstream outdated and update code documents those modes.

Vagrant's catalog model stores versions with provider-specific URLs, checksums, checksum types, and architectures. The upstream tests contain a compact catalog metadata example, and BoxMetadata::Provider defines the provider fields. Direct file checks support MD5, SHA-1, SHA-256, SHA-384, and SHA-512.

A YAML definition alone cannot expose all of these operations through GenericManager. The current Manager interface and option types cannot pass a catalog URL, provider, architecture, checksum, or removal selectors. Add the smallest backward-compatible option path needed for the high-level manager methods, rather than limiting these fields to direct BuildCommand calls.

Use Vagrant's global --no-tty flag for commands that must not prompt, and --machine-readable where structured output is available. Both are defined by the top-level CLI. Do not add install: vagrant up also creates or starts a machine. Do not add path: the box storage layout is an internal collection detail and there is no box path command.

Tests should cover namespaced names, exact versions, providers, architectures, one-argument descriptors, two-argument name and catalog URL forms, local catalog files, all supported checksum types, machine-readable list output, global outdated checks, targeted updates, and non-interactive removal. Include high-level GenericManager tests for the new option path, plus capability tests proving that install and path are not declared.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions