[06:39] dean: hello o/ can you please be more specific about the problem? [16:37] hi folks im currently working on a cloud-init datasource for cluster-api-provider-aws. some background here when CAPA would provision a machine it would take the initial user-data, and then download more "secure" userdata from aws ssm. after downloading that it would restart cloud-init. [16:39] the code for this new datasource is here now https://github.com/kubernetes-sigs/image-builder/pull/158 and everything seems to be populated in the right place. the file /var/lib/cloud/instances/i-/cloud-config.txt has all the correct contents [16:39] but nothing actaully runs. would someone be able to help me figure out what's going wrong [16:57] Does '/etc/cloud/cloud-init.disabled' exist? [17:02] ls: cannot access '/etc/cloud/cloud-init.disabled': No such file or directory [17:32] the data also isn't templated by jinja either [17:32] i feel like i need to do this with a boothook? [17:33] for example i see this [17:33] name: '{{ ds.meta_data.local_hostname }}' [17:46] I'm experimenting with including a shell script in vendor data, and it seems to work on fresh instances (gets written and executed) when I set the Content-Type to text/cloud-boothook or text/x-shellscript. But when I try text/x-shellscript-per-instance it gets written under /var/lib/cloud/scripts/vendor/per-instance/ but I do not see it executed in /var/log/cloud-init.log on a fresh instance like I do with the other content types. Does anyone have [17:46] any ideas for further debugging this? [17:47] "scripts_vendor" is listed under cloud_final_modules. I noticed there's also "scripts_per_once", "scripts_per_boot", "scripts_per_instance". Are there vendordata analogs to those I need to factor in? [18:08] faiqus: was ds-identify updated to know about/detect this new DataSource? [19:41] faiqus: the link you shared doesn't appear to be relevant to the issue that you described [19:43] connor_k: are you sure that it is really a fresh instance? if you run `cloud-init clean` and try rebooting does it work with the -per-instance script? [19:44] holmanb: yeah, I've tried using cloud-init clean, but no avail. I also created brand-new VMs where using the x-shellscript-per-instance and didn't observe the "Running command ... " line in /var/log/cloudinit.log like I did with the other content types [19:45] connor_k: err, is looking for identical logs the only way that you're checking if it is worki9ng? [19:47] holmanb: in the gh pull he referenced there's a comment from "faiq" which has a link to the DS code in question [19:48] https://github.com/kubernetes-sigs/image-builder/compare/main...faiq:image-builder:custom-ami-ds [19:51] weird, for me the link redirects to this issue which doesn't appear relevant: https://github.com/kubernetes-sigs/image-builder/issues/158 [19:51] -ubottu:#cloud-init- Issue 158 in kubernetes-sigs/image-builder "Ensure the SSM agent is installed and running in AWS images" [Closed] [19:52] yeah that happened to me also earlier [19:53] ah, the original url was truncated, there's a missing "3" [19:53] #1583 [19:53] gotcha, thanks [19:54] I don't understand why that DS is trying to restart the cloud-init service... [19:58] holmanb: no, the script should `echo hello >> /tmp/helloworld.txt` -- I was mainly referencing the cloud-init logs since I thought it would be forensically useful when I noticed that the Running command ... appeared in the logs for each content-type that worked for me but was absent when I switched the content-type to text/x-shellscript-per-instance [20:05] minimal: it's not trying to restart the cloud-init service [20:05] it's commenting out the restart in the cloud-init service [20:06] it's convoluted [20:06] ah ok [20:09] faiqus: Pastbin the logs, please. [20:12] connor_k: you too [20:23] hi folks sorry i had to step out. i will paste bin the logs momentarily [20:25] https://pastebin.com/Du9A8ds4 [20:26] faiqus: also /var/log/cloud-init.log [20:27] that is entirely empty [20:27] faiqus: ahh right, if memoryy serves correctly you have a custom log configuration [20:27] wc -l /var/log/cloud-init.log 0 /var/log/cloud-init.log [20:28] so yeah this /var/lib/cloud/instances/i-<>/user-data.txt has all the bits but there are two issues with it. 1. the jinja templates aren't rendered 2. it doesn't run [20:29] faiqus: you'll need to figure out where those logs are going or switch to the default log configuration temporarily [20:30] how would i do that? [20:30] faiqus: under /etc/cloud/cloud.cfg.d there is a file [20:30] probably 05_logging.cfg [20:31] that should have the log configuration [20:31] this is the upstream default: https://github.com/canonical/cloud-init/blob/main/config/cloud.cfg.d/05_logging.cfg [20:32] it looks almost identitical to the upstream one [20:33] https://pastebin.com/NuBGupMM [20:34] faiqus: well it's not identical, the term which defines the log file is different [20:35] oh sorry - the "almost" was doing a lot of work in the last message. what should i change? [20:36] I don't know all the details of your setup [20:37] but I'd try just using the upstream default configuration [20:37] ok i will copy and paste that. [20:38] im gonna build a new ami and run it - stay tuned. and thank you again for the help [21:10] holmanb: modifiying the log file to the upstream has given me a lot of logs. let me prepare a pastebin for you [21:12] holmanb: https://pastebin.com/a5HqKVsR [21:15] the cloud-init-output.log looks about the same as the previous paste [21:24] faiqus: is the secret user-data always a jinja configuration? [21:25] yeah, it will have jinja configuration. [21:26] i think almost always because it needs the host name [21:33] i couldn't find any convience functions to template that data in other datasources [21:41] yes, any time cloud-init will process the "secret" userdata there will be jinja configuraiton [22:16] holmanb: I think I found a lead: https://github.com/canonical/cloud-init/commit/42f2cffadabfefb0469ade2f1f1c3ce5edabc9fa [22:16] -ubottu:#cloud-init- Commit 42f2cff in canonical/cloud-init "remove vendor-scripts-per-{boot,instance,once}" [22:41] im trying to parse the data but i can't seem to do that either. i imported this function -- render_jinja_payload_from_file. but its complaining that neither of these files: /run/cloud-init/instance-data-sensitive.json /run/cloud-init/instance-data.json is present