Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing metadata.json (Packer (push) -> ATLAS (build) -> Vagrant (download)) #2090

Closed
tobiasbaehr opened this issue May 2, 2015 · 12 comments
Labels

Comments

@tobiasbaehr
Copy link

Atlas builds the vagrant.box, but when I try to use it, vagrant tell me that there is no metadata.json.

My tpl:

{
  "min_packer_version": "0.7.5",
  "variables": {
    "debian_version": "8.0.0",
    "box_version": "1.0.0"
  },
  "builders": [
    {
      "type": "virtualbox-iso",
      "iso_checksum": "d9209f355449fe13db3963571b1f52d4",
      "iso_checksum_type": "md5",
      "iso_url": "http://cdimage.debian.org/cdimage/release/current/amd64/iso-cd/debian-{{user `debian_version`}}-amd64-netinst.iso",
      "boot_command": [
        "<esc> ",
        "install ",
        "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/jessie.preseed.cfg ",
        "debian-installer=de_DE ",
        "auto ",
        "locale=de_DE ",
        "kbd-chooser/method=de ",
        "netcfg/get_hostname=dockerhost.dev ",
        "netcfg/get_domain=dockerhost.dev ",
        "fb=false ",
        "debconf/frontend=noninteractive ",
        "console-setup/ask_detect=false ",
        "console-keymaps-at/keymap=de ",
        "keyboard-configuration/xkb-keymap=de ",
        "<enter>"
      ],
      "boot_wait": "4s",
      "disk_size": "100000",
      "guest_additions_mode": "disable",
      "guest_os_type": "Debian_64",
      "headless": false,
      "http_directory": "http",
      "shutdown_command": "echo 'vagrant' | sudo -S shutdown -h now",
      "ssh_username": "vagrant",
      "ssh_password": "vagrant",
      "ssh_port": 22,
      "vm_name": "debian-{{user `debian_version`}}"
    }
  ],
  "push": {
    "name": "tobiasb/dctest",
    "base_dir": ".",
    "vcs": true
  },
  "provisioners": [
    {
      "type": "shell",
      "scripts": [
        "scripts/base.sh",
        "scripts/vagrant.sh",
        "scripts/install_software.sh",
        "scripts/cleanup.sh"
      ],
      "override": {
        "virtualbox-iso": {
          "execute_command": "echo 'vagrant' | sudo -S sh '{{ .Path }}'"
        }
      }
    }
  ],
  "post-processors": [
    {
      "type": "vagrant",
      "keep_input_artifact": false
    },
    {
      "type": "atlas",
      "only": ["virtualbox-iso"],
      "artifact": "tobiasb/dctest",
      "artifact_type": "vagrant.box",
      "metadata": {
        "provider": "virtualbox"
      }
    }
  ]
}

Terminal output:

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'tobiasb/dctest' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'tobiasb/dctest'
    default: URL: https://atlas.hashicorp.com/tobiasb/dctest
==> default: Adding box 'tobiasb/dctest' (v0.8) for provider: virtualbox
    default: Downloading: https://atlas.hashicorp.com/tobiasb/boxes/dctest/versions/0.8/providers/virtualbox.box
The "metadata.json" file for the box 'tobiasb/dctest' was not found.
Boxes require this file in order for Vagrant to determine the
provider it was made for. If you made the box, please add a
"metadata.json" file to it. If someone else made the box, please
notify the box creator that the box is corrupt. Documentation for
box file format can be found at the URL below:

http://docs.vagrantup.com/v2/boxes/format.html

And btw I do not find the options for artifact_type. And the "Delete" button on Atlas (https://atlas.hashicorp.com/VENDOR/boxes/BOXNAME/settings) do not delete my boxes or packer tpl configs it just hide it from the boxes/configs list https://atlas.hashicorp.com/vagrant. I can unarchive it again to the frontend list. And I believe this not what we want. ;-)

@stevenrombauts
Copy link

+1 Having the same issue at the moment. Box builds perfectly but on vagrant up I get the "metadata.json missing" error. However, looking at the build log on Atlas, the file seems to have been created. Build log output:

==> virtualbox-iso (vagrant): Creating Vagrant box for 'virtualbox' provider
    virtualbox-iso (vagrant): Copying from artifact: output-virtualbox-iso/packer-virtualbox-iso-1433025348-disk1.vmdk
    virtualbox-iso (vagrant): Copying from artifact: output-virtualbox-iso/packer-virtualbox-iso-1433025348.ovf
    virtualbox-iso (vagrant): Renaming the OVF to box.ovf...
    virtualbox-iso (vagrant): Using custom Vagrantfile: Vagrantfile.pkg
    virtualbox-iso (vagrant): Compressing: Vagrantfile
    virtualbox-iso (vagrant): Compressing: box.ovf
    virtualbox-iso (vagrant): Compressing: metadata.json
    virtualbox-iso (vagrant): Compressing: packer-virtualbox-iso-1433025348-disk1.vmdk
==> virtualbox-iso: Running post-processor: atlas
    virtualbox-iso (atlas): Uploading artifact version...
Build 'virtualbox-iso' finished.

==> Builds finished. The artifacts of successful builds are:
--> virtualbox-iso: VM files in directory: output-virtualbox-iso
--> virtualbox-iso: 'virtualbox' provider box: packer_virtualbox-iso_virtualbox.box
--> virtualbox-iso: kotuha/joomlatools-box/vagrant.box (v1)

Another thing that I noticed was that it's impossible to use a user variable inside the metadata fields? This failed to work:

   "variables": { "release_version": "1.3.0" }
   ...
    {
      "type": "atlas",
      "only": ["virtualbox-iso"],
      "artifact": "joomlatools/box",
      "artifact_type": "vagrant.box",
      "metadata": {
        "provider": "virtualbox",
        "version": "{{user `release_version`}}"
      }
    }

@kikitux
Copy link
Collaborator

kikitux commented Jun 1, 2015

Hello

Please note there is a double array on the post processor in the example:

https://github.com/hashicorp/atlas-packer-vagrant-tutorial/blob/master/template.json#L87-L112

So this should be:

  "post-processors": [
    [{
      "type": "vagrant",
      "keep_input_artifact": false
    },
    {
      "type": "atlas",
      "only": ["virtualbox-iso"],
      "artifact": "tobiasb/dctest",
      "artifact_type": "vagrant.box",
      "metadata": {
        "provider": "virtualbox"
      }
    }]
  ]

@stevenrombauts
Copy link

Thank you @kikitux ! Fixing the double array made the build succeed on my end.

@kikitux
Copy link
Collaborator

kikitux commented Jun 4, 2015

@stevenrombauts no problem.

As you found, at the moment the version can't be a variable.

what you can do, is leave that out, and packer push will generate one.

@sethvargo
Copy link
Contributor

Hi @tobiasbaehr @stevenrombauts @kikitux

We actually just added interpolation in all stanza of Packer, so this should work now. We still need to update Packer on the Atlas side, but it will work locally 😄

@stevenrombauts
Copy link

@kikitux @sethvargo Great news, thanks for the heads-up! :)

zealic added a commit to zealic/packer-boxes that referenced this issue Jun 6, 2015
@tobiasbaehr
Copy link
Author

yes double array works. But why is there a double array?

And why it works with:

{"post-processors":[
"type": "vagrant",
"output": "builds/debian-{{user `debian_version`}}-amd64-{{user `box_version`}}.box",
"compression_level": 9
]}

@mitchellh
Copy link
Contributor

Fixed!

@tobiasbaehr Please see the section post-processor chains (should be in the post-processor section, just the general section) on the docs.

@kikitux
Copy link
Collaborator

kikitux commented Jul 13, 2015

@tobiasbaehr

The double array is required if you want to feed a post-processor into another post-processor.

A typical use case is

  • build virtualbox box
  • post processor
    = vagrant
    = upload to atlas

with the double array you ensure vagrant box is feeded into upload to atlas.

in your example, the vagrant post-processor alone, will create a local vagrant box, that's what you run locally.

aoki added a commit to aoki/packer-scientifclinux that referenced this issue Jul 31, 2015
- Ref: (Missing metadata.json (Packer (push) -> ATLAS (build) -> Vagrant (download)))[hashicorp/packer#2090]
jamescarr added a commit to jamescarr/puppet-ansible-base-box that referenced this issue Aug 16, 2015
@lylianmeyemezu
Copy link

Hi all,
I have the same problem.
When i upload vagrant created box manually to atlas, it works fine.
When using atlas packer post-processor, i get the same error .

@kikitux
Copy link
Collaborator

kikitux commented Aug 20, 2015

@lylianmeyemezu Please send an email to the packer mailing list with your packer template for review.

You are commenting on a closed issue.

@lylianmeyemezu
Copy link

Oups...sorry

bltavares pushed a commit to bltavares/openstack-infra-development-box that referenced this issue Sep 10, 2015
simbo added a commit to simbo/packer-trusty64 that referenced this issue Oct 14, 2015
mudler added a commit to mudler/sabayon-packer that referenced this issue Oct 16, 2015
TFDuesing added a commit to TFDuesing/packer-templates that referenced this issue Nov 30, 2015
dspeckhard added a commit to dspeckhard/atlas-packer-vagrant-BIMServer that referenced this issue Dec 30, 2015
takaesu-ug added a commit to takaesu-ug/packers that referenced this issue Mar 7, 2016
* [Missing metadata.json (Packer (push) -> ATLAS (build) -> Vagrant (download)) · Issue #2090 · mitchellh/packer](hashicorp/packer#2090)
percygrunwald added a commit to percygrunwald/packer-elixir-phoenix-centos7 that referenced this issue May 18, 2016
kurron added a commit to kurron/packer-experiment that referenced this issue Sep 18, 2016
hashicorp/packer#2090 says we should use double array.
shearn89 added a commit to shearn89/toughen-ci that referenced this issue May 8, 2017
@hashicorp hashicorp locked and limited conversation to collaborators Apr 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants