Packer 0.6.0 template wont parse (used to work fine)

792 views
Skip to first unread message

Timothy Perrett

unread,
May 6, 2014, 1:01:35 AM5/6/14
to packe...@googlegroups.com
Hey guys,

I upgraded to packer 0.6.0 and now my template fails to load with the following error when im trying to debug it locally using var-file argument:
Error compiling user variables: json: cannot unmarshal object into Go value of type string

I think the issue is around the var-file arg, as when i dont specify it the template does load. The var-file is typically what we use for local debugging, and use it to partially apply the variable set. For example, the template has these variables:

  "variables": {
    "aws_access_key": "{{env `AWS_ACCESS_KEY`}}",
    "aws_secret_key": "{{env `AWS_SECRET_KEY`}}",
    "packer_region": "{{env `PACKER_REGION`}}",
    "packer_foundation_ami": "{{env `PACKER_FOUNDATION_AMI`}}",
    "username": "{{env `USER`}}"
  }

Whilst the var-file would contain:

{
  "packer_region": "us-west-2",
  "packer_foundation_ami": "ami-xxxx"
}

As I still want the rest to read from the environment.

What's causing this strange behaviour... is it a bug in 0.6.0?

Thanks!

-- T

Mitchell Hashimoto

unread,
May 6, 2014, 12:24:37 PM5/6/14
to packe...@googlegroups.com
Hi!

This is 99.999% due to the new internal encoding scheme mentioned in
the 0.6.0 release email. I'm going to try to reproduce this. If you
could help: could you make a minimal template + vars file to reproduce
this?

Best,
Mitchell
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.

Timothy Perrett

unread,
May 6, 2014, 1:43:52 PM5/6/14
to packe...@googlegroups.com
Ok this is super strange - but I restarted my machine this morning and now it works... perhaps there was something conflicting in the $PATH when upgrading from 0.5.2. I havent been able to make a reproducing, isolated case yet.

Very strange. 

-- T

Himanshu Pant

unread,
Feb 24, 2017, 6:24:48 AM2/24/17
to Packer
I am trying to get an application server up and running. I changed the Ubuntu distribution in the template file to point to latest Ubuntu (16.x instead of 14.x it came with) and now I am getting the below message.

packer build -only=virtualbox-iso application-server.json

Failed to parse template: Error parsing JSON: invalid character '\n' in string literal

At line 5, column 1 (offset 113):

    4:       "PACKER_BOX_NAME": "ubuntu-16.04.2-server-i386”,

    5: 

      ^


 
Any idea what this could be ? The message makes it look like its a simple new line error but unable to see this from my template json file.

Rickard von Essen

unread,
Feb 24, 2017, 8:38:47 AM2/24/17
to packe...@googlegroups.com
Looks like you don't have a proper end double quote (zoom in).

"PACKER_BOX_NAME": "ubuntu-16.04.2-server-i386”,

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/055b3cb4-1ba6-404b-b4dd-aa91eeceffea%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages