rubiojr / knife-esx

@maintux's FORK IS NOW OFFICIAL: https://github.com/maintux/knife-esx
https://github.com/maintux/knife-esx
Apache License 2.0
35 stars 10 forks source link

--json-attributes not merged into first-boot.json #15

Open milesburton opened 11 years ago

milesburton commented 11 years ago

Hi all,

After some digging I can't seem to get the --json-attributes command to add the associated attributes to the first-boot.json file on the bootstrapped node.

Example command: knife esx vm create --vm-name "node" --use-template Ubuntu_1210_template.vmdk --verbose true --distro ubuntu12.04-19-gems --vm-memory 2048 -x miles -i ~/.ssh/id_rsa --run-list $RUN_LIST --json-attributes '{"set_fqdn":"node", "set_hostname":"node"}'

Resulting first-boot.json file {"run_list":["recipe[chef-client]","recipe[chef-cookbook-hostname]","recipe[users]","recipe[chef-ipaddress]"]}

If I manually bootstrap the node using chef-client providing the -j atribute and an associated json file it works as expected.

Any thoughts?

milesburton commented 11 years ago

For those reading, the temporary work around is to use a role and associate your attributes to that instead.

cdosso commented 10 years ago

That issue could be easily fixed in your bootstrap template like this :

(
cat <<'EOP'
<%= @config[:first_boot_attributes].merge({ "run_list" => @run_list }).to_json %>
EOP
) > /etc/chef/first-boot.json

Cheers