hashicorp / hashicorp/packer-plugin-vagrant

valid box file not generated when using artifacts from 'artifice' post-processor with provider_override="hyperv"

Open
#121 0 comments 0 reactions 0 assignees View on GitHub
bug stage/needs-investigation
Dominant language
Go
Stars
16
Forks
28
PR merge metrics
No merged PRs in 30d

Description

#### Overview of the Issue
When this post processor is used with artifacts from the 'artifice' post processor along with the provider_override="hyperv", the resulting .box output file does not seem to be valid.

#### Reproduction Steps
Prerequisite:
1. following Hyper V vm source files :

![image](https://github.com/hashicorp/packer-plugin-vagrant/assets/20064961/3f5e0682-7f17-4e1c-835b-75fb4f1db176)

2. packer with the necessary plugins installed
3. Execute : packer build
- Expected behaviour: a working vagrant box (.box file) is generated from the hyperv source files
- Observed behaviour:
- An incomplete .box file file is generated (see attached file:packer_example_hyperv_amd64.box in the zip file ).
[packer_example_hyperv_amd64.zip](https://github.com/hashicorp/packer-plugin-vagrant/files/15332676/packer_example_hyperv_amd64.zip)

- No Hyper-v VM artifacts are present in the .box file. It only contains the vagrantfile and the metadata.json. Also the input
artifacts are being copied to 'c:\users\' folder which was not expected behaviour.

### Plugin and Packer version

![image](https://github.com/hashicorp/packer-plugin-vagrant/assets/20064961/bb28d4f5-644c-4948-bc7e-c6b7f61521db)

![image](https://github.com/hashicorp/packer-plugin-vagrant/assets/20064961/7f242487-06aa-46bb-9646-d43686017c29)

### Simplified Packer Buildfile
file: vagrant_post_processor_hyperv.pkr.hcl
``` packer {
required_plugins {
vagrant = {
version = "~> 1"
source = "github.com/hashicorp/vagrant"
}
}
}

source "null" "example" {
communicator = "none"
}

build {
sources = [
"source.null.example"
]
post-processors {
post-processor "artifice" {
files = [
"output-windows10/Virtual Hard Disks/VnV-W10-001.vhdx",
"output-windows10/Virtual Machines/4643F645-2EDB-4DD5-8E17-18A7DE59893C.vmcx",
"output-windows10/Virtual Machines/4643F645-2EDB-4DD5-8E17-18A7DE59893C.vmgs",
"output-windows10/Virtual Machines/4643F645-2EDB-4DD5-8E17-18A7DE59893C.VMRS",
"output-windows10/Virtual Machines/box.xml"
]
}
post-processor "vagrant" {
keep_input_artifact = true
provider_override = "hyperv"
}
}
}
```

### Operating system and Environment details

![image](https://github.com/hashicorp/packer-plugin-vagrant/assets/20064961/84b6e02d-b92d-4d11-ba27-3c30e61aea6e)

![image](https://github.com/hashicorp/packer-plugin-vagrant/assets/20064961/c82cf86c-abe9-4047-ae93-1155e136dccc)

### Log Fragments and crash.log files

See attached log file from the CMD prompt ( packer_build_logt.txt) for the packer build:

[packer_build_logt.txt](https://github.com/hashicorp/packer-plugin-vagrant/files/15332713/packer_build_logt.txt)

Contributor guide

Open the contributing guide

Research direction

Start with the simplified vagrant_post_processor_hyperv.pkr.hcl buildfile and the attached packer_build_logt.txt, then trace how artifacts from the artifice post-processor are handled when provider_override is hyperv. Reproduce the build and verify that the generated .box contains the Hyper-V artifacts rather than only the Vagrantfile and metadata.json.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.