/srv/irclogs.ubuntu.com/2024/01/19/#cloud-init.txt

=== apollo13_ is now known as apollo13
=== caribou_ is now known as caribou
Viktor87Hi everyone! Can I configure cloud-init not to run the second script in MIME multi-part userdata if the first script failed?19:41
Viktor87```19:42
Viktor87MIME-Version: 1.019:42
Viktor87Content-Type: multipart/mixed; boundary="//"19:42
Viktor87--//19:42
Viktor87Content-Type: text/x-shellscript; charset="us-ascii"19:42
Viktor87#!/usr/bin/env bash19:42
Viktor87exit 119:42
Viktor87--//19:42
Viktor87Content-Type: text/x-shellscript; charset="us-ascii"19:42
Viktor87#!/bin/bash19:42
Viktor87exit 019:42
Viktor87--//--19:42
Viktor87```19:42
Viktor87In the cloud-init log I have:19:44
Viktor87Jan 19 18:20:46 cloud-init[2692]: util.py[DEBUG]: Running command ['/var/lib/cloud/instance/scripts/part-001'] with allowed return codes [0] (shell=True, capture=False)19:44
Viktor87Jan 19 18:21:31 cloud-init[2692]: util.py[WARNING]: Failed running /var/lib/cloud/instance/scripts/part-001 [2]19:44
Viktor87...19:44
Viktor87Jan 19 18:21:31 cloud-init[2692]: util.py[DEBUG]: Running command ['/var/lib/cloud/instance/scripts/part-002'] with allowed return codes [0] (shell=True, capture=False)19:44
Viktor87....19:44
holmanbHey Viktor87 o/19:44
holmanbI suppose you could do some sort of file-based IPC if you wanted19:46
Viktor87I don't control the second script. The userdata is generated by karpenter and my script is inserted first. But I can control the mime header.19:47
holmanbah19:47
holmanbhmm19:48
Viktor87I guess they take my script and use "cloud-init devel" to generate the result userdata file.19:48
Viktor87The problem is that the things they initialize in their script shouldn't be initialized if my script fails.19:49
holmanbViktor87: you could try writing a custom handler to override the behavior of x-shellscript https://cloudinit.readthedocs.io/en/latest/explanation/format.html#part-handler19:50
holmanbthis actually sounds like a pretty similar question to this recent bug report: https://github.com/canonical/cloud-init/issues/457219:51
-ubottu:#cloud-init- Issue 4572 in canonical/cloud-init "Boothook not executing for cloud-init 'ubuntu/23.3.1-0ubuntu1_20.04.1'" [Open]19:51
holmanbViktor87: do you know if there is any connection between your issue and that bug report?19:52
Viktor87No I don't think so19:56
holmanbthanks19:56
meenaminimal: https://wandering.shop/@gavi/11178485767194999322:23
minimalmeena: never a truer word spoken in jest? lol22:31

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!