sparse-intern-71089
02/08/2022, 10:09 PMlittle-cartoon-10569
02/08/2022, 10:25 PMcontent
has to be the actual content. filename
is just a string that is put into the MIME part header.little-cartoon-10569
02/08/2022, 10:26 PMlittle-cartoon-10569
02/08/2022, 10:29 PMrendered
on the object returned from get_config, in order to get the rendered JSON object of the MIME parts.flaky-beach-82888
02/08/2022, 11:23 PM# read cloud-init config payload from file
with open(cloud_init_path) as f:
init_payload = f.read()
# create cloud-init config
foo = cloudinit.get_config(base64_encode=False,
gzip=False,
parts=[cloudinit.GetConfigPartArgs(
content=init_payload,
content_type="text/cloud-config",
filename="init.cfg",
)])
node0 = hcloud.Server(
get_name('node'),
image=image,
location=location,
server_type=server_type,
ssh_keys=[default_ssh.id],
user_data=foo.rendered # set cloudinit config
)