[19:41] <Viktor87> Hi everyone! Can I configure cloud-init not to run the second script in MIME multi-part userdata if the first script failed?
[19:42] <Viktor87> ```
[19:42] <Viktor87> MIME-Version: 1.0
[19:42] <Viktor87> Content-Type: multipart/mixed; boundary="//"
[19:42] <Viktor87> --//
[19:42] <Viktor87> Content-Type: text/x-shellscript; charset="us-ascii"
[19:42] <Viktor87> #!/usr/bin/env bash
[19:42] <Viktor87> exit 1
[19:42] <Viktor87> --//
[19:42] <Viktor87> Content-Type: text/x-shellscript; charset="us-ascii"
[19:42] <Viktor87> #!/bin/bash
[19:42] <Viktor87> exit 0
[19:42] <Viktor87> --//--
[19:42] <Viktor87> ```
[19:44] <Viktor87> In the cloud-init log I have:
[19:44] <Viktor87> Jan 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] <Viktor87> Jan 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] <Viktor87> Jan 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] <holmanb> Hey Viktor87 o/
[19:46] <holmanb> I suppose you could do some sort of file-based IPC if you wanted
[19:47] <Viktor87> I 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] <holmanb> ah
[19:48] <holmanb> hmm
[19:48] <Viktor87> I guess they take my script and use "cloud-init devel" to generate the result userdata file.
[19:49] <Viktor87> The problem is that the things they initialize in their script shouldn't be initialized if my script fails.
[19:50] <holmanb> Viktor87: you could try writing a custom handler to override the behavior of x-shellscript https://cloudinit.readthedocs.io/en/latest/explanation/format.html#part-handler
[19:51] <holmanb> this actually sounds like a pretty similar question to this recent bug report: https://github.com/canonical/cloud-init/issues/4572
[19: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:52] <holmanb> Viktor87: do you know if there is any connection between your issue and that bug report?
[19:56] <Viktor87> No I don't think so
[19:56] <holmanb> thanks
[22:23] <meena> minimal: https://wandering.shop/@gavi/111784857671949993
[22:31] <minimal> meena: never a truer word spoken in jest? lol