Why do some boolean values in YAML config end up as strings?


#1
$ lxc network edit lxdbr0

config:
  ipv4.address: 10.200.0.1/24
  ipv4.dhcp: "true"                   # Why do these need to be in quotes?
  ipv4.firewall: "false"
  ipv4.nat: "false"
  ipv4.routing: "true"
  ipv6.address: none
name: lxdbr0
managed: true                         # But this doesn't?

$ lxc --version
3.0.3

The default comment in network config edits is aligned with my expectation:

### This is a yaml representation of the network.
### Any line starting with a '# will be ignored.
###
### A network consists of a set of configuration items.
###
### An example would look like:
### name: lxdbr0
### config:
###   ipv4.address: 10.62.42.1/24
###   ipv4.nat: true
###   ipv6.address: fd00:56ad:9f7a:9800::1/64
###   ipv6.nat: true
### managed: true
### type: bridge
###
### Note that only the configuration can be changed.

(St├ęphane Graber) #2

The config maps are map[string]string inside of LXD, so a key/value of string and string.
Any other type will fail parsing.

Having specific types for every key would make parsing in Go much harder and would also prevent us from turning a boolean into a multi-value key later without breaking backward compatibility in the process.