← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1939119] Re: cloud-init not parsing the instance metadata when provided under "/etc/cloud/cloud.cfg.d/

 

This is expected. While you can technically put user-data into
cloud.cfg, it isn't meant for that, and it isn't considered a user-data
script. When that page refers to "user-data scripts and #cloud-config
data", it's referring to configuration received via one of these
methods: https://cloudinit.readthedocs.io/en/latest/topics/format.html


** Changed in: cloud-init
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1939119

Title:
  cloud-init not parsing the instance metadata when provided under
  "/etc/cloud/cloud.cfg.d/

Status in cloud-init:
  Invalid

Bug description:
  According to cloud-init document,
  https://cloudinit.readthedocs.io/en/latest/topics/instancedata.html#using-instance-data
  Both user-data scripts and #cloud-config data support jinja template rendering. When the first line of the provided user-data begins with, ## template: jinja cloud-init will use jinja to render that file.

  I have tested user-data with jinja variable, it works as expected.
  now my question is, does cloud-init support parsing the instance metadata when provided under "/etc/cloud/cloud.cfg.d/ ?  

  For example,
  A config file /etc/cloud/cloud.cfg.d/99-lob_unmanaged.cfg is created with the below content in a VM on Azure cloud.

  ===
  ## template: jinja
  #cloud-config
  runcmd:
    - echo "{{ ds.meta_data.imds.compute.tags }}" > /root/vm_tags.txt
  ===

  However, during the cloud-init initialization, the instance metadata
  is not parsed and the file is created with the below data.

  $ cat /root/vm_tags.txt
  {{ ds.meta_data.imds.compute.tags }}

  The scripts also have unparsed data.

  ]$ cat var/lib/cloud/instance/scripts/runcmd 
  #!/bin/sh
  echo "{{ ds.meta_data.imds.compute.tags }}" > /root/vm_tags.txt

  Could anyone please help to confirm, is it a bug or expected result?

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1939119/+subscriptions



References