Comment 7 for bug 1841104

Revision history for this message
Manish Mahalwal (mmahalwa) wrote :

Thank you for your response @andrewboggot!

1. Can you confirm if the /var/lib/cloud/instances/<your-instance>/vendor-data2.txt contains the content of the YAML you passed?

2. When I set the name as cloud-init@<URL> in nova.conf, my custom REST service (to which Nova sends a POST request to) has to respond with a JSON string. The JSON string with which it responds is:
{"cloud-init": "#cloud-config\npackage_upgrade: True\npackages:\n - htop"}

The openstack/latest/vendor_data2.json file becomes:
{"cloud-init": {"cloud-init": "#cloud-config\npackage_upgrade: True\npackages:\n - htop"}}

This too is not parsed by cloud-init. If the REST service responds with only the YAML (the value pair) which is `#cloud-config\npackage_upgrade: True\npackages:\n - htop`, Nova refuses to accept this string because it is expecting a VALID JSON. So, I am unable to remove that extra layer in my JSON, to make it exactly like your JSON. I also tried leaving the `name@` field empty, but that doesn't work too.

>>So, how do I remove that extra layer of JSON to test if this works as expected?

On a different note, whether <name> value has a different meaning:
I may be wrong on this but, the intention of having the `name` field is just to have a name for the REST service from which the JSON came. For example, I have several REST services to query from which I have to fetch vendor data.

From (https://specs.openstack.org/openstack/nova-specs/specs/newton/implemented/vendordata-reboot.html)
"Each REST microservice is configured by appending a new item to the list provided in the vendordata_dynamic_targets flag. This flag is composed of entries of the form:"

vendordata_dynamic_targets=name1@http://example.com,name2@http://example2.com

The name element for these microservices becomes the new key for the vendor_data2.json file like,

{
    "name1": {
        "cloud-init": "#cloud-config\n..."
    },
    "name2": {
        "cloud-init": "#cloud-config\n..."
    }
}

Please note I have taken the above example from the Nova specs mentioned earlier and extended it for 2 REST services. Now, if we consider your approach of having cloud-init as the outer key, then how are we going to differentiate b/w several REST services.