Hacker News new | ask | show | jobs
by esbeeb 998 days ago
Your YAML example doesn't need double-quotes around the IPv4 addresses, but then very confusingly and problematically does need double-quotes around an IPv6 address, due to the colons.

This creates a serious footgun in Ubuntu netplan, leaving a server totally unbootable, but simultaneously not triggering "netplan try" as any sort of parsing problem:

https://news.ycombinator.com/item?id=37591110

3 comments

And Javascript doesn't need semicolons in all but three exceptional cases, but I still consider it good form to strongly type values whenever possible.

Getting in the habit of not doing so will lead to schema violations, like the Netplan problem you linked, which can crash the program trying to read your config. If it bails out at an unfortunate time, like most networking tools seem to do, you'll need to use a recovery boot image or serial console to fix your config.

Can you elaborate about colons?

    % echo '{"address": "2::0"}' | yq -P -
    address: 2::0
yq seems to be happy with unquoted colons.

String with ": " inside have to be quoted, that's correct, however you won't have space in your IPv6 address unless I miss something.

> This creates a serious footgun in Ubuntu netplan, leaving a server totally unbootable, but simultaneously not triggering "netplan try" as any sort of parsing problem:

Been there, done that. A good config file or linter should’ve complained and not allowed me to commit such misstake.