创建工件时出错:找不到资源

时间:2015-11-17 13:57:49

标签: packer

我很擅长使用Packer,我想帮助解决我遇到的问题。我似乎无法找到有关此错误的任何信息。本地计算机和推送后的地图集都会出现此错误。

运行Packer v.0.8.7.dev

请帮助我!

错误:

==> virtualbox-iso: Running post-processor: atlas
    virtualbox-iso (atlas): Creating artifact: /
Build 'virtualbox-iso' errored: 1 error(s) occurred:

* Post-processor failed: Error creating artifact: resource not found

==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: 1 error(s) occurred:

* Post-processor failed: Error creating artifact: resource not found

==> Builds finished but no artifacts were created.

配置:

{
    "push": {
      "name": "",
      "vcs": true
    },
    "variables": {
        "atlas_username": "{{env `ATLAS_USERNAME`}}",
        "atlas_name": "{{env `ATLAS_NAME`}}"
    },
    "provisioners": [
        {
            "type": "shell",
            "scripts": [
                "scripts/base.sh",
                "scripts/virtualbox.sh",
                "scripts/vmware.sh",
                "scripts/vagrant.sh",
                "scripts/dep.sh",
                "scripts/cleanup.sh",
                "scripts/zerodisk.sh",
                "scripts/custom.sh"
            ],
            "override": {
                "virtualbox-iso": {
                    "execute_command": "echo 'vagrant'|sudo -S bash '{{.Path}}'"
                },
                "vmware-iso": {
                    "execute_command": "echo 'vagrant'|sudo -S bash '{{.Path}}'"
                }
            }
        }
    ],
    "builders": [
        {
            "type": "virtualbox-iso",
            "boot_command": [
                "<esc><esc><enter><wait>",
                "/install/vmlinuz noapic preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
                "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
                "hostname={{ .Name }} ",
                "fb=false debconf/frontend=noninteractive ",
                "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA keyboard-configuration/variant=USA console-setup/ask_detect=false ",
                "initrd=/install/initrd.gz -- <enter>"
            ],
            "headless": false,
            "boot_wait": "10s",
            "disk_size": 20480,
            "guest_os_type": "Ubuntu_64",
            "http_directory": "http",
            "iso_checksum": "c2571c4c2fc17bef1fad9e5db5e7afdb4bd29cd8ab51e42f9c036238c4e54caa",
            "iso_checksum_type": "sha256",
            "iso_url": "http://ftp.acc.umu.se/mirror/cdimage.ubuntu.com/releases/14.04/release/ubuntu-14.04.3-server-amd64+mac.iso",
            "ssh_username": "vagrant",
            "ssh_password": "vagrant",
            "ssh_port": 22,
            "ssh_wait_timeout": "10000s",
            "shutdown_command": "echo '/sbin/halt -h -p' > shutdown.sh; echo 'vagrant'|sudo -S bash 'shutdown.sh'",
            "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
            "virtualbox_version_file": ".vbox_version"
        },
        {
            "type": "vmware-iso",
            "boot_command": [
                "<esc><esc><enter><wait>",
                "/install/vmlinuz noapic preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
                "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
                "hostname={{ .Name }} ",
                "fb=false debconf/frontend=noninteractive ",
                "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA keyboard-configuration/variant=USA console-setup/ask_detect=false ",
                "initrd=/install/initrd.gz -- <enter>"
            ],
            "boot_wait": "10s",
            "disk_size": 20480,
            "guest_os_type": "Ubuntu-64",
            "headless": true,
            "http_directory": "http",
            "iso_checksum": "af224223de99e2a730b67d7785b657f549be0d63221188e105445f75fb8305c9",
            "iso_checksum_type": "sha256",
            "iso_url": "http://releases.ubuntu.com/precise/ubuntu-12.04.5-server-amd64.iso",
            "skip_compaction": true,
            "ssh_username": "vagrant",
            "ssh_password": "vagrant",
            "ssh_port": 22,
            "ssh_wait_timeout": "10000s",
            "shutdown_command": "echo '/sbin/halt -h -p' > shutdown.sh; echo 'vagrant'|sudo -S bash 'shutdown.sh'",
            "tools_upload_flavor": "linux"
        }
    ],
    "post-processors": [
        [{
            "type": "vagrant",
            "keep_input_artifact": true
        },
        {
            "type": "atlas",
            "only": ["vmware-iso"],
            "artifact": "{{user `atlas_username`}}/{{user `atlas_name`}}",
            "artifact_type": "vagrant.box",
            "metadata": {
                "provider": "vmware_desktop",
                "version": "0.0.1"
            }
        },
        {
            "type": "atlas",
            "only": ["virtualbox-iso"],
            "artifact": "{{user `atlas_username`}}/{{user `atlas_name`}}",
            "artifact_type": "vagrant.box",
            "metadata": {
                "provider": "virtualbox",
                "version": "0.0.1"
            }
        }]
    ]
}

1 个答案:

答案 0 :(得分:3)

你得到了

virtualbox-iso (atlas): Creating artifact: /

所以看来你的变量来自

"variables": {
    "atlas_username": "{{env `ATLAS_USERNAME`}}",
    "atlas_name": "{{env `ATLAS_NAME`}}"
},

未正确设置 - 请确保它们已设置或首先尝试进行硬编码。

另外作为附注,在最新的doc中建议使用atlas_token访问地图集

"post-processors": [
  {
    "type": "atlas",
    "only": ["virtualbox-iso"],
    "token": "{{user `atlas_token`}}",
    "artifact": "hashicorp/foobar",
    "artifact_type": "vagrant.box",
    "metadata": {
      "provider": "virtualbox",
      "version": "0.0.1"
      "created_at": "{{timestamp}}"
    }
  }
]