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 [email protected]/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 [email protected]/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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With