Question

I have a web server that basically accepts input for a knife ec2 create server command.

In my knife command, I pass in

-j '{"branch":"clone"}'

From documentation I thought I would be able to do this in my recipes that are being loaded:

@@branch = node['branch']
...
git clone git@github.com/blah -b #{@@branch}

However, the git clones are failing because @@branch doesn't return. Or atleast the chef logs say begin output of result:

git clone git@github.com/blah -b

~Git error showing options and appropriate input~

How do I load in my passed JSON attribute? What is the correct way?

Edit:

I manually put in the knife command, and the JSON Attributes seem to load using Ruby hash instead of JSON

JSON Attributes: {"branch"=>"Air"}

Last Edit:

My command:

sudo knife ec2 server create -x ubuntu -i ~/.ssh/key.pem -I ami-0eca6e67 -d ubuntu-12.04 -j '{ "branch" : "clone" }' -Z us-east-1a -s subnet-6827ec00 -f c1.medium -g sg-bc9d86d0 -r 'role[role]'

Answer below.

Was it helpful?

Solution

So it seems if I use a bootstrap template that already exists, -d ubuntu-12.04, knife ec2 does NOT load -j json-attributes.

Get rid of the -d option. Json loads appropriately.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top