[11:59] Hi all. Please prepare for some n00b questions. === shardy is now known as shardy_afk [12:00] So, I am planning to use openstack with rhel 6.9 and need to learn about cloud-init a bit. But the docs seem to go from "here's a file structure" straight into a here's a load of config. [12:01] So, for an ice-breaker here, how can I set the /etc/hostname from the metadata passed form openstack? [12:02] I believe this is a built-in function [12:04] nvm, I'm gonna youtube and stop pestering you guys :-) === shardy_afk is now known as shardy [16:59] bug 1734939 [16:59] bug 1734939 in cloud-init (Ubuntu) "#include fails silently." [High,Confirmed] https://launchpad.net/bugs/1734939 [16:59] sigh [16:59] hrm did I break that? checking the bug [17:08] blackboxsw: no [17:08] you did not. [17:08] no idea how long its been broken :-( [17:23] smoser: isn't that bionic no-dns issue? did you try that on xenial instead ? [17:24] ah, this is a reporting of the failure [17:39] rharper: yeah, it is that issue. and will become harder to reproduce if that were fixed :) [17:39] (probably we can use 404) [17:39] blackboxsw: what am i missing at https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/333513 [17:40] smoser: was just looking that over. I'm not sure what the prob is. The new subcommand is 'cloud-init status' not systemctl status [17:40] I didn't wire that into systemctl cmd entrypoints [17:42] maybe it's just a disconnect about what we really want for 'cloud-init status' I was expecting scripts could call into our cli to 'cloud-init status --wait' if their services needed to hold until cloud-init was done. [17:43] smoser: should we instead wire that subcommand into systemctl status so that custom params can be provided? [18:05] blackboxsw: i must not have been clear. [18:05] you are using the presense of systemctl binary to indicate "this is systemd" [18:05] at least i think [18:17] smoser: we mentioned in comment "moving distro.uses_systemd" where should that live? It seems specific to distro-related attributes and be hesitant to further bloat cloudinit.util [18:18] maybe it could just be a separate public function in cloudinit.distro instead of a class attribute of Distro [18:18] cloudinit.distro.__init__ [18:22] though cloud.distro.uses_systemd() method is called from cc_mounts, ntp, fan and rsyslog modules (as well as rhel/opensuse distros). So, we'd have to explicitly import the public function there and use that instead (or have Distro.uses_systemd be a wrapper that just calls the separate function uses_systemd). [18:22] maybe I'll just do that. I'm in hangout if you want to chat through other options [18:25] joining [18:25] I could be swayed to moving uses_systemd it to cloudinit.util too. We'll have to take a pass extracting functions out of cloudinit.util anyway at some point to make it more modular and focused [18:29] smoser: surely urllib returns something on DNS resolution failure vs. 404 [18:32] rharper: right. but shoudl also fail and exit failure on 404 [18:32] and that is easier to create a test for [18:32] than to break dns [18:32] for sure [18:32] I see, you were referring to how to reproduce/test [19:38] Hi all, what's the process for adding features to a datasource? [19:39] Azure is adding a feature where they are going to keep VM's 'warm' and hold it at boot till a customer needs it... [19:42] here's the MP with the code they have been working on https://code.launchpad.net/~dojordan/cloud-init/+git/cloud-init/+merge/334341/+index?ss=1 [19:42] do we need an LP bug? [19:48] paulmey: you dont strictly need a bug, but for a feature like that i guess i'd like one. gives a place to "hold" [19:48] i'm not bent on it, but its not like it is hard to file a bug either. [19:56] ok, you want a bug... 😉 [20:02] https://bugs.launchpad.net/cloud-init/+bug/1734991 [20:02] Launchpad bug 1734991 in cloud-init "cloud-init doesn't yet support azure vm preprovisioning" [Undecided,New] [20:22] hrm smoser rharper systemctl status cloud-init.target isn't conclusive. Even when cloud-init is pending (but runcmd is camping on a sleep) [20:22] then ActiveState remains 'inactive' and is-enabled remains 'static' until the magical moment when cloud-init is done and transitions to 'enabled' [20:22] or 'active' [20:23] I'm looking for another mechanism to detemine 'cloud-init is pending in systemd' [20:26] it really feels like cloud-init's manipulation of systemd's $gen_d/${target_name}.wants/${CLOUD_TARGET_NAME} link is our best source of knowing if cloud-init really is going to run [20:27] or systemctl list-dependencies [20:33] feels like systemctl list-dependencies | grep cloud-init.target is probably the best bet [20:33] as tracking details of the link file names would be fragile if that link path changes in future releases. [20:43] blackboxsw: you can query the list of jobs to see if it's pending [20:43] I didn't think we needed that state though [20:43] the tri state was (disabled, never going to run), (enabled and is pending), (enabled is done) [20:43] is there something missing there? [20:45] rharper: yeah double checking today on xenial.... we have is-enabled returns 'static' if cloud-init.target is active, and if it is disabled via kernel cmdline or /etc/cloud/cloud-init.disabled [20:46] so I can't inspect disabled if we've disabled our systemd generator via /etc/cloud/cloud-init.disabled or kernel cmdline [20:46] s/inspect/introspec/ [20:46] I didn't think that was the case [20:46] * rharper reads the unit file states again [20:48] I tried adding a #cloud-config\nruncmd: ['sleep 60'] and I also don't get to see an enabled status untl http://pastebin.ubuntu.com/26066805/ [20:49] until cloud-init.target completes [20:49] static == off (never going to run) [20:49] on a system currenty in runcmd final stage http://pastebin.ubuntu.com/26066812/ [20:49] on xenial the default is (it runs less it's told not to) [20:50] ie, ds-identify is report-only [20:50] static is on a system where cloud-init is enabled [20:50] blackboxsw: https://hastebin.com/raw/qetelayimi [20:50] that is what i put together to collect info. [20:50] i ran it for xenial, but yeah, didnt see anything that said "expected to be run" [20:51] "static" The unit file is not enabled, and has no provisions for enabling in the "[Install]" unit file section. [20:51] rharper: then I guess systemd is lying or how cloud-init links or doesn't link the wants file is breaking systemd? [20:51] not following [20:52] cloud-init.target gets dynamically installed [20:52] so, an at-rest system is going to say static [20:52] early, we generator run, and on xenial, the default is to enable unless we disable via file or cmdline [20:52] our cloud-init generator only dynamically links for wants file if we don't have /etc/cloud/cloud-init.disabled or the cloud-init=disabled in the kernel cmdline [20:52] correct [20:53] but you can't run status before the generator runs [20:53] a cloud-init user cannot [20:53] but systemd is-enabled must be checking something else, because it doesn't report 'enabled' on a system that has those links [20:53] it enabled" Enabled via .wants/, .requires/ or Alias= symlinks (permanently in /etc/systemd/system/, or transiently in /run/systemd/system/). [20:53] so, once generator adds it to a .wants [20:54] then it will show enabled (that's post generator) [20:54] that means cloud-init status should show *pending* until you have a file that indicates cloud-init is done (result.json) [20:54] disabled; or pending -> done [20:54] rharper: here's a system that has already run all of cloud-init note is-enabled still shows 'static' [20:54] http://pastebin.ubuntu.com/26066859/ [20:54] and you have a result.json ? [20:55] yeah with no errors [20:55] the output of systemctl isn only relevant when we don't know [20:55] we only need to know, disabled (never going to run, this is 'static') or we have a result file ; if not those cases, then pending [20:56] recall, that is-enabled refers to the *unit* file [20:56] not the active job [20:56] systemd builds a tree of units, for each unit, it spawns a job [20:56] the job runs and is removed from the job queue [20:59] well, cloud-init remain Active when they're done. [20:59] the units, yes [20:59] but really the status command is meant to refer to the runtime element, (ie, the systemd job) [21:00] we're interestd in asking systemd "are you expecting to reach the cloud-init target." thats what we need to know. [21:00] we're not using status now. [21:00] we're using show. [21:00] if you're suggesting we look at the unit instead of a target, i dont know if that would hcange anything or not. [21:01] a target is just a special unit AFAIK [21:02] even if we ignore the jobs; I think we have enough, given the result file an disabled; if we're not disabled and we don't have a result file, then we're pending [21:03] I'm still lacking how we determine that we are disabled. as I don't see anything from systemd cli that properly reports whether we are disabled [21:03] right. [21:03] there is nothing there. [21:03] its obnoxious [21:03] static means disabled [21:04] we can determine ourselves by looking at cloud-init.disabled OR kernel cmdline [21:04] static also means enabled [21:04] and not yet run [21:04] no it does not [21:04] well, yes, but you can't ask that [21:04] before the generator runs [21:04] static does not mean disabled [21:04] rharper: even after generator runs [21:04] I still see 'static' [21:04] right. [21:05] well, modulo bugs [21:05] systemd says that once it's added to a .wants it's enabled (or enabled-runtime) [21:05] so, maybe we have bug in xenial systemd w.r.t state [21:05] notice in artful/bionic [21:05] it says enabled-runtime [21:06] which is the correct answer [21:06] in xenial [21:06] right, artful/bionic look sane. <= zesty behave differently [21:06] https://www.freedesktop.org/software/systemd/man/systemctl.html# [21:06] well, they have newer systemd [21:06] the man page is pretty clear on this [21:07] "enabled" Enabled via .wants/, .requires/ or Alias= symlinks (permanently in /etc/systemd/system/, or transiently in /run/systemd/system/). [21:07] so, it should be 'static'; then when generator runs, if enabled, it will transition to enabled (or enabled-runtime) due to a symlnk in /run/systemd/system/multi.user.target.wants/cloud-init.target [21:07] I don;t think I'm misreading that man page [21:08] the results differ. [21:10] aka, bug in xenial systemd's systemctl status ; are you referring to something else? [21:10] s/status/is-enabled [21:11] http://pastebin.ubuntu.com/26066998/ [21:11] referring to a bug in is-enabled [21:11] the above is on zesty [21:11] running in an enabled world first, then disabled 2nd [21:12] not the units, the target [21:12] we only put cloud-init.target in .wants in /run [21:12] I ran against cloud-init, cloud-init.target and cloud-init.service [21:13] so querying the unit files (cloud-init-local , cloud-init, cloud-config, cloud-final) isn't helpful [21:13] blackboxsw: right, but do target only on artful/bionic [21:13] does it not report enabled-* vs. static ? [21:14] rharper: right we are good on artful ++ http://pastebin.ubuntu.com/26067021/ [21:14] just broken on xenial & zesty (from our point of view) [21:15] ok, so we file a bug [21:15] so we can get proper is-enabled status for cloud-init.target [21:15] I don't think any other trickery is going to help w.r.t systemd commands [21:15] * rharper relocates [21:19] smoser/rharper: Ok so, systemctl list-dependencies does give us an idea about 'pending' cloud-init wants target, and 'systemctl is-enabled' works on artful and above. But, filing a bug aside, it's probably just best for us to only look at the /etc/cloud/cloud-init.disabled file and kernel cmdline for determining if we are disabled for the time being, if not disabled... assume pending until result.json [21:19] exists right? [21:21] the other gap in that logic (checking disabled file or cmdline) is ds-identify disabling us [21:21] maybe the 'fix' is for ds-dentify to precipitate a /etc/cloud/cloud-init.disabled file with 'disabled by ds-identify' content. [21:22] then we've covered that gap without relying on older systemd tooling which doesn't currently work [21:24] blackboxsw: writing something. almost done. [21:26] http://paste.ubuntu.com/26067095/ [21:30] blackboxsw: ^ [21:30] basically, forget about asking systemd. it seems useless to me [21:30] reading [21:30] yeah agreed on systemd [21:31] not enough info there yet (but we'll file a bug) [21:31] ahh didn't realize the ds-identify writes an enabled file [21:34] ok so yeah we can look for presence of (disabled file or kernel cmdline disable) or absence of /run/cloud-init/enabled [21:34] that makes sense (and works today) [21:35] ok, smoser I'm not going to move around the uses_systemd function/method then as we don't need it [21:39] well, blackboxsw when not running on systemd [21:40] smoser why does that matter? [21:40] as sysvinit is always on? [21:40] because there is no generator? [21:40] right [21:40] roger [21:40] the generator writes /run/cloud-init/enabled [21:40] ahh right times two [21:41] ok keeping uses_systemd :/ [21:41] on systemd we get that benefit. -- easy and complete knowledge of "disabled". [21:41] hahah [21:41] well, assuming we do not run before the generator [21:41] but i'm willing to acept that for now. [21:46] we can check whether the cloud-init generator has run via the /run/cloud-init dir presence [21:46] that can catch the inb4-cloud-init-generator case [21:50] sure ds-identify creates that dir if it doesn't exist [21:50] rharper: well, but the generator creates that [21:50] no? [21:50] yes [21:50] so, if the dir doesn't exist [21:51] I see it in ds-identify [21:51] then it hasn't run [21:51] that's for the case of testing status before the generator runs [21:51] if we wanted to support status that early, we could say something like (too early) or whatever [21:51] ask-later [21:51] looks like both generator and ds-identify try to create that dir if !present [21:51] oh. well we can't determine what the status is anyway then. we can know we're in that state i guess. [21:52] right, similar to systemd-analyze saying 'boot not finished yet' [21:52] not particulary helpful but it is some sort of non-answer-answer [21:53] I'm perfectly fine with not handling the case as that's super early [21:55] in my tests with my script above, we're in at "1.0" seconds per lxc's /proc/uptime. [21:55] and it exists already. [21:55] there isnt a *lot* of opportunity to run 'cloud-init wait' earlier than that [21:55] ie: [21:55] lxc start name; lxc exec name -- cloud-init wait [23:56] finally wrapped it up and overhauled cloud-init status to use cloudinit.helpers.Paths object https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/333513