Error in vagrant-cloud postprocessor with Hyper-V box

21 views
Skip to first unread message

Yusuke Masuda

unread,
Oct 4, 2019, 10:50:56 AM10/4/19
to Packer
Hello,

I try to upload my box with vagrant-cloud post-processor.
But it failed with an error below.

Build 'hyperv-iso' errored: 1 error(s) occurred:
* Post-processor failed: Unknown artifact type, requires box from vagrant post-processor or vagrant builder: MSOpenTech.hyperv

I configured my packer that it creates the box for hyperv using hyperv-iso builder and run the vagrant post-processor prior the vagrant-cloud post-processor.
I am not sure but I expect that it can be worked as long as I am using the vagrant post-processor from the message showed.

The post-processors part of my source code is:
  "post-processors": [
    {
      "type": "vagrant",
      "keep_input_artifact": false,
      "output": "windows10_{{.Provider}}.box",
      "vagrantfile_template": "vagrantfile-windows10.template"
    },
    {
        "type": "vagrant-cloud",
        "box_tag": "ymasuda/windows10",
        "access_token": "{{user `cloud_token`}}",
        "version": "{{user `version`}}"
    }
  ],

I configured it following the example which showed in the vagrant-cloud page of the official help page.
See whole packer template in https://github.com/yusukemasuda/packer-windows if you need.
Please be aware the one that it is before adding the vagrant-cloud post-processor, I added the code above and its variables on it.

I also took a look the packer source code in GitHub.
var builtins = map[string]string{
    "mitchellh.post-processor.vagrant": "vagrant",
    "packer.post-processor.artifice":   "artifice",
    "vagrant":                          "vagrant",
}
    :
    :
func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) {
    if _, ok := builtins[artifact.BuilderId()]; !ok {
        return nil, false, false, fmt.Errorf(
            "Unknown artifact type, requires box from vagrant post-processor or vagrant builder: %s", artifact.BuilderId())
    }


Will it really work with just using vagrant post-processor, even if I use the hyperv builder?
The source code seemingly expecting some combinations.

Can I use vagrant-cloud post-processor even if I am using hyperv builder?


Regards,

Yusuke. 

Megan Marsh

unread,
Oct 4, 2019, 12:32:03 PM10/4/19
to packe...@googlegroups.com
You are missing a set of brackets -- check the docs here https://www.packer.io/docs/templates/post-processors.html and read about sequence definitions. If you want post-processors to use artifacts from previous post-processors, rather than artifacts from the original build, you need to wrap them in a second set of brackets. E.g. 


  "post-processors": [
     [
    {
      "type": "vagrant",
      "keep_input_artifact": false,
      "output": "windows10_{{.Provider}}.box",
      "vagrantfile_template": "vagrantfile-windows10.template"
    },
    {
        "type": "vagrant-cloud",
        "box_tag": "ymasuda/windows10",
        "access_token": "{{user `cloud_token`}}",
        "version": "{{user `version`}}"
    }
  ]
],
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/ea037e68-b7d9-45d2-b0a2-4302b556e73d%40googlegroups.com.

Yusuke Masuda

unread,
Oct 5, 2019, 9:55:13 AM10/5/19
to Packer
Hi Megan,

Thank you for your advice.
I was very helpful for me.
I can achieve to upload my box to Vagrant Cloud.
I was sorry for such basic question. I would check the official document in advance next time.

Best regards,


Yusuke


2019年10月5日土曜日 1時32分03秒 UTC+9 Megan Marsh:
To unsubscribe from this group and stop receiving emails from it, send an email to packe...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages