← Back to team overview

cloud-init team mailing list archive

Re: Merge userdata and vendordata?

 

Unfortunately merging only happens within a configuration source, so for example you can merge multiple configs from /etc/cloud/cloud.cfg.d  and you can merge mime multipart parts from userdata, but a merge strategy doesn't define what happens when the file configs are merged with the userdata.

See https://bugs.launchpad.net/cloud-init/+bug/1532234 for some background and thinking on this.

Kind Regards,
Andrew Jorgensen

________________________________________
From: Cloud-init <cloud-init-bounces+ajorgens=amazon.com@xxxxxxxxxxxxxxxxxxx> on behalf of Thomas Stringer <Thomas.Stringer@xxxxxxxxxxxxx>
Sent: Tuesday, August 20, 2019 12:51 PM
To: cloud-init@xxxxxxxxxxxxxxxxxxx
Subject: [Cloud-init] Merge userdata and vendordata?

I'm currently trying to figure out how to prevent userdata from overwriting vendordata. I was under the impression that specifying merge_how for _both_ userdata and vendordata might be the solution, but in my testing I am not seeing this.

Userdata - /var/lib/cloud/instance/user-data.txt
===========================
#cloud-config
merge_how:
 - name: list
   settings: [append]
 - name: dict
   settings: [no_replace, recurse_list]

runcmd:
  - echo hello world from user  > /run/hello_world_user

Vendordata - /var/lib/cloud/instance/vendor-data.txt
===========================
#cloud-config
merge_how:
 - name: list
   settings: [append]
 - name: dict
   settings: [no_replace, recurse_list]

runcmd:
  - echo hello world from vendor  > /run/hello_world_vendor


I would expect the existence of _both_ files, /run/hello_world_user and /run/hello_world_vendor. But only /run/hello_world_user exists. Am I doing something wrong? If merge_how isn't the way to merge vendordata and userdata, is there another way?

Thank you in advance!
Thomas

--
Mailing list: https://launchpad.net/~cloud-init
Post to     : cloud-init@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~cloud-init
More help   : https://help.launchpad.net/ListHelp


Follow ups

References