/srv/irclogs.ubuntu.com/2022/04/15/#cloud-init.txt

=== gschanuel6 is now known as gschanuel
blackboxswfalcojr: I think I've finally addressed all the complexities of the user/groups schema. Too many options please recheck docs I rewrote for typo/grammar misses etc.17:37
minimalblackboxsw: side-equestion - do the schemas in general take into account a requirement for some values to be quoted (so they *are* treated as strings, not numbers)?17:52
minimalthinking of values like dates where (from memory) they are treated as numeric equations (i.e. "-" as minus) unless quoted17:52
blackboxswminimal: the JSON schema looks at the YAML type as it is interpreted. For dates specifically, we'd have to declare something like {"type": "string" "format": "date"} for our schema to allow without error.  Ultimately when YAML loads the date, it can accept things like `date: 2022-04-15` and yaml.safe_load turns it into the python dict `{"date": datetime.date(2032,  4, 15)}`18:02
blackboxswit may have been an older version of YAML that bungled the date formatted strings 18:03
blackboxswbut to answer your underlying question, JSON schema validation is on the content which has been interpreted by YAML during load I believe18:04
minimalblackboxsw: I'm thinking back to a MR I had merged maybe 12-18 months ago to fix some of the user-data examples including things like expiry date as they didn't work without quotes - so you think the quotes are no longer needed?18:07
minimalah, here's the MR I'm thinking of: https://github.com/canonical/cloud-init/pull/61818:10
ubottuPull 618 in canonical/cloud-init "Correct documentation and testcase data for some user-data YAML" [Merged]18:10
blackboxswminimal: and examples that have landed on every cloudinit/config/cc_* module are automatically run through validation by CI in our unittests per  https://github.com/canonical/cloud-init/blob/main/tests/unittests/config/test_schema.py#L40118:10
blackboxswminimal: ahh right, so I just made the schema in this case specifically require a type: string https://github.com/canonical/cloud-init/pull/1379/files#diff-c18cfd88ec0bd5f1077576fee00a0b2e87cf0b30aa547ad1eaacfd5742e4a757R2718:15
ubottuPull 1379 in canonical/cloud-init "Schema users" [Open]18:15
blackboxswbut hrm, maybe worth properly supporting a date type. Reviews comments welcome on my open PR here.18:15
blackboxswminimal: though I might want to pull in that functionality in a separate PR as this one has gotten a lot bigger than I'd hoped18:16
minimalblackboxsw: no issue with it defining string, was just wanting to clarify if single quotes are therefore still needed in the YAML for it to be treated as a string18:16
blackboxswso at the moment, schema will tell you you have to have a string18:16
minimalI guess my question is regarding implicit versus explicit strings in YAML18:18
minimalas I thought the underlying problem was the Python YAML lib used could misinterpret implicit strings like dates18:19
falcojrminimal: I think that's just a yaml problem more broadly18:21
minimalin other words will "expiredate: 2022-04-16" pass both the schema validation and be treated by the code as a date, or will it pass the schema validation but be treated by the code as a number, in which case the schema needs to enforce "expiredate: '2022-04-16'" instead18:22
blackboxswminimal: sorry just dropped the laptop trying to paste that example.  Schema will warn about non string I. That case 18:23
minimalblackboxsw: warn about non-string? or non-explicit-string?18:24
blackboxswminimal https://paste.ubuntu.com/p/WgscmSjkxg/18:24
blackboxswyet quoted     `expiredate: "2024-10-04"  ` will pass without warnings18:25
minimalfor that paste, is login for a Launchpad acct?18:26
blackboxswbah18:26
blackboxswpasting elsewhere18:26
blackboxswminimal: 2nd try https://paste.opendev.org/show/bgROMPxKtqtahai5C6w0/18:27
=== holman is now known as holmanb
minimalok, that seems to answer my question. Thanks18:28
blackboxswI do wonder if JSON schema can handle date discrete date types anyway, but as falcojr mentioned it's probably a JSON schema/YAML general prob to sort.18:29
blackboxswI forsee that I'll spend some googling time today :)18:29
holmanbstarted in on ephemeraldhcp for v6 and one bugfix led to another and I guess I just refactored the networking code a bit: https://github.com/canonical/cloud-init/pull/138318:30
ubottuPull 1383 in canonical/cloud-init "Network functions refactor and bugfixes" [Open]18:30
minimalyeah YAML is a mess with its "magic detection" of types - remember the issue I'd raised again 18months or so ago about MAC address treatment lol18:30
blackboxswheh true. I had forgotten about that.18:30
blackboxsw-> relocating for lunch18:30
blackboxswnice fast work holmanb 18:31
minimalblackboxsw: if you ever doing any future work on expiredate (and/or "inactive"), there's no testing in place for those (validating the numbers put into /etc/shadow fields) and I've never found the time to have a go at it myself18:31
holmanb@blackboxsw: don't get too excited, that's only bugfixes + refactorization ;) - no ephemeral work in that 18:32
holmanbblackboxsw: I was just like "alright let's make is_ipv6_addr not so awful real quick", and after fixing it suddenly 125 tests were failing :/18:37
blackboxswThanks falcojr https://github.com/canonical/cloud-init/pull/1379 landed.19:53
ubottuPull 1379 in canonical/cloud-init "Schema users" [Merged]19:53
falcojrnice!19:53
blackboxswknocked out a number of JIRA tickets with that given the 'enum' doc handling and 'hidden' key thank!19:53
blackboxswthank you for the correct assessment of that schema crud in review19:53
blackboxswfalcojr: one minor PR for migrating legacy schema coming 19:56
blackboxsw$ fgrep -r "schema =" cloudinit/config/cc_*19:56
blackboxswcloudinit/config/cc_ntp.py:schema = {19:56
holmanb@falcojr: Thanks for the review, just landed https://github.com/canonical/cloud-init/pull/1383 (tests passed after the spelling nit commit)20:01
blackboxswminor followup to migrate ntp legacy schema https://github.com/canonical/cloud-init/pull/138420:47
ubottuPull 1384 in canonical/cloud-init "cc_ntp: migrated legacy schema to cloud-init-schema.json" [Open]20:48
blackboxswok hitting James' review now.20:48
blackboxswfalcojr: cc_* meta looks good I think minimally we want to filter docs out of `cloud-init devel schema --docs all` for those modules without JSON schema.21:47
blackboxswotherwise big +1 on cleanup\21:47
falcojrTIL 'cloud-init devel schema --docs all' :D21:47
falcojrnever realized you could get doc info on the cli21:48
holmanb:)21:48
blackboxswyeah developer docs21:48
blackboxswyeah it's been my saving grace while going through and reviewing and schema changes21:48
blackboxswmuch faster than iterating through `tox -e doc`21:48
blackboxswand visually comparing 21:48
falcojrso I DIDN'T need to 'tox -e doc' a million times this whole time?21:48
falcojr;)21:49
blackboxswha! well next time we rewrite the whole schema we can use it :)21:49
falcojrheh, just give it a couple more years21:49
blackboxsw#toosoon21:49
holmanbif we throw half of it away first it won't take so long on the rewrite :)22:00
blackboxswgetting to EOW holmanb but minor thought on ssh-import-id https://github.com/canonical/cloud-init/pull/1334/files22:07
ubottuPull 1334 in canonical/cloud-init "declare dependency on ssh-import-id (SC-864)" [Open]22:07
holmanb@blackboxsw: looking now22:09
blackboxswsorry might want to refresh on latest comment22:10
holmanb+1: I assumed that's what you meant22:10
holmanboh last comment, not updated suggested change, I see now22:14
blackboxswahh sorry will redact my suggested change in that first comment. as I think the latter is more appropriate given multiple entrypoints to ssh-import-id22:16
holmanbblackboxsw: np at all - at the rate that my own EOW is approaching, however, I think this is going to have to wait until monday to implement the second comment22:18
blackboxswholmanb: totally get that. I'm about turning the lights off over her 22:19
blackboxsw*here22:19
blackboxswhey CloudCIX is going to look at implementing EphermealDHCP4 support for local timeframe IMDS detection... so that'll be good. that PR will likely idle to stale while they do that.22:20
holmanbI saw that, sounds good to me22:21
holmanbmaking some progress on EphemeralDHCP6 today, I grok it quite a bit more at least22:22
holmanb*made22:22
blackboxswawesome, that'll help a few folks trying to spin up systems ipv6/dhcp6 only envs.22:31
blackboxswfor that ds-identify branch detected NoCloud in `/etc/cloud/cloud.cfg(.d/*)` I've got to run it through the paces with live-server installer ephemeral environment and make sure we don't get into a pickle with current implementation22:34
blackboxswso, probably won't finish that review today22:34

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