On 15/04/2021 15:53, Manish Mahalwal wrote:
Hi All,
I am working with OpenStack Pike and cloud-init 21.1. I am able to successfully pass dynamic vendor data to the config drive of an instance. However, cloud-init 21.1 just reads all the 'x' bytes of the vendor_data2.json but it doesn't execute the contents of the json. Although, static vendor data works perfectly fine and the YAML file in the JSON is executed as expected by cloud-init 21.1
* Now, the person who wrote the code for handling dynamic vendordata in cloud-init (https://github.com/canonical/cloud-init/pull/777 <https://github.com/canonical/cloud-init/pull/777>) says that the JSON cloud-init expects is of the form:
{"cloud-init": "#cloud-config\npackage_upgrade: True\npackages:\n - black\nfqdn: cloud-overridden-by-vendordata2.example.org."}
the reference implementation for the dynamic vendor data backend was https://github.com/mikalstill/vendordata and it was a feature developed specificaly for rackspace. the data format that service should return is # { # "hostname": "foo", # "image-id": "75a74383-f276-4774-8074-8c4e3ff2ca64", # "instance-id": "2ae914e9-f5ab-44ce-b2a2-dcf8373d899d", # "metadata": {}, # "project-id": "039d104b7a5c4631b4ba6524d0b9e981", # "user-data": null # } # An example of this data: https://github.com/mikalstill/vendordata/blob/master/app.py#L34-L42 this blog post explains how it should work https://www.madebymikal.com/nova-vendordata-deployment-an-excessively-detail...
* I believe that the JSON should have another outer key (as mentioned here https://specs.openstack.org/openstack/nova-specs/specs/newton/implemented/ve... <https://specs.openstack.org/openstack/nova-specs/specs/newton/implemented/vendordata-reboot.html>) which is the name of the microservice specified in nova.conf file and that the inner key should be cloud-init.
In nova.conf: vendordata_dynamic_targets=name1@http://example.com,name2@http://example2.com <http://example.com,name2@http//example2.com>
{ "name1": { "cloud-init": "#cloud-config\n..." }, "name2": { "cloud-init": "#cloud-config\n..." } }
Who is right and who is wrong?
To read more on this please go through the following: https://bugs.launchpad.net/cloud-init/+bug/1841104 <https://bugs.launchpad.net/cloud-init/+bug/1841104>