from cloudinit.handlers import cloud_config
from cloudinit import handlers
from cloudinit import helpers
from cloudinit import log as logging
logging.setupBasicLogging()
# Put your yaml sections in here.
pieces = []
pieces.append(
"""#cloud-config
a: b
"""
)
# Set things up...
ctype = handlers.type_from_starts_with(cloud_config.CLOUD_PREFIX)
h = cloud_config.CloudConfigPartHandler(helpers.Paths({}))
h.handle_part("", handlers.CONTENT_START, "", "", "", {})
for p in pieces:
h.handle_part("", ctype, "", p, "", {})
print("Merged result:")
print(h.cloud_buf)