Packer: openstack: Show error message

Created on 16 Oct 2017  ยท  15Comments  ยท  Source: hashicorp/packer

Packer should output the openstack-api-messages when something goes wrong.

example :

the (nova-api-) message

{"message": "Build of instance 8e5bd927-9e0f-463f-8744-2b16e03e0f90 aborted: Failed to allocate the network(s) with error No fixed IP addresses available for network: bf433df0-b7e3-4ad1-849d-4a449b0b7ece, not rescheduling.", "code": 500, "created": "2017-10-16T07:25:11Z"}

right now shows only up as

"Build 'openstack' errored: Error waiting for server (8e5bd927-9e0f-463f-8744-2b16e03e0f90) to become ready: unexpected state 'ERROR', wanted target '[ACTIVE]'"

when trying to run my openstack-builder (even with "PACKER_LOG=1" and "-debug" activated).

this behavior is insufficient, I think.

Please let Packer show the complete message. To me, this seems to be absolutely essential.

buildeopenstack enhancement upstream-bug

Most helpful comment

I've just tested with Packer 1.3.1 and it is fixed.

The easy reproduction of this issue is to set some invalid networks in packer.json. E.g.:

"builders": [
    {
      "type": "openstack",
      "networks": [ "aaaaaaaaaaaaaaaa" ]
      # other configuration ommitted
    }
  ],

All 15 comments

I think this is as simple as:

    if err != nil {
        err := fmt.Errorf("Error creating image: %s", err)
        state.Put("error", err)
        ui.Error(err.Error())
        return multistep.ActionHalt
}

The second line needs to do err.Error() to get the actual error message. (In all the places we receive a error from gophercloud)

@meinteuch22 can you try #5488, I haven't had an opportunity to test it. If you want a binary just tell me for which OS.

Rickard,

a binary would be great !
my OS is :

CentOS Linux release 7.3.1611 (Core)

thanks and best regards,
jean-gert

Here you go: packer_pr-5488_g6ba4595a8.zip (macOS) (Had to zip it since GH don't allow executable binary attachments.)

Hi! I was hoping to try the test build attached above, to help debug this openstack error, however it looks to be an OS X binary rather than Linux x86_64?

Oh, sorry. This should be better packer_pr-5488_6ba4595a8.zip (Linux amd64).

I did some more research and this seems to only part of the solution. The cli seems to do some validation of parameters by doing additional API calls.

Thank you for the build. I'm not sure if I'm doing something wrong, but with it I get:
* unknown configuration key: "version"
(https://travis-ci.org/travis-infrastructure/packer-build/builds/303289257#L1050)

The only reference to version in the template (see higher up in the log for the template, which I dumped to stdout) is the chef-solo version, but I still get the error even if I remove that?

the build works for me but does not show the intended effect of returning the error-messages that are being returned by the OpenStack API(s).

as an example, easy to be reproduced :

use a non existing image-id as the value of the source_image-field in a openstack-builder-section of your Packer-template. In this case the OpenStack API returns:

json {"badRequest": {"message": "Can not find requested image", "code": 400}}

(this is what you see, when you run tcpdump in parallel to the Packer-session)

Packer, in this case, returns _"Error launching source server: Invalid request due to incorrect syntax or missing required parameters."_ which is of course a bit sparse...

I'd like to spend some time in researching and improving the Packer-code in this respect too. Maybe next week.

@meinteuch22 I think you are correct. This needs some deeper research and since we just print the error returned by gophercloud I think that would the best place to start checking.

Hi! I've managed to get the test build above working (I think it's based on an older Packer base revision which doesn't appear to like the chef-solo version property in the packer template, so I just removed it for now), however I still can't work out what's failing from the log output:
https://travis-ci.org/travis-infrastructure/packer-build/builds/308944435#L1201

The reason of this issue is actually an issue in Packer dependency - gophercloud: https://github.com/gophercloud/gophercloud/issues/243 .

I've just tested with Packer 1.3.1 and it is fixed.

The easy reproduction of this issue is to set some invalid networks in packer.json. E.g.:

"builders": [
    {
      "type": "openstack",
      "networks": [ "aaaaaaaaaaaaaaaa" ]
      # other configuration ommitted
    }
  ],

Awesome, thanks for reporting back.

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Tensho picture Tensho  ยท  3Comments

mushon4 picture mushon4  ยท  3Comments

paulcdejean picture paulcdejean  ยท  3Comments

frezbo picture frezbo  ยท  3Comments

DanielBo picture DanielBo  ยท  3Comments