Comment 0 for bug 1724951

Chad Smith (chad.smith) wrote :

Our docs and jsonschema definition allows an empty cloud-config definition for ntp. When provided, that empty cloud-config definition should just install ntp with sensible defaults


"If no ntp servers or pools are provided, 4 pools will be used in the format {0-3}.{distro}"

When running with an empty ntp cloud-config, we get a traceback from cc_ntp.

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cloudinit/", line 793, in _run_modules
  File "/usr/lib/python3/dist-packages/cloudinit/", line 54, in run
    return, functor, args, freq, clear_on_fail)
  File "/usr/lib/python3/dist-packages/cloudinit/", line 187, in run
    results = functor(*args)
  File "/usr/lib/python3/dist-packages/cloudinit/config/", line 109, in handle
    " is a %s %instead"), type_utils.obj_name(ntp_cfg))
RuntimeError: ("'ntp' key existed in config, but not a dictionary type, is a %s %instead", 'NoneType')

Steps to reproduce:
$ cat >ntp.yaml <<EOF

# validate schema
$ python3 -m cloudinit.cmd.main devel schema --annotate -c ntp.yaml
Valid cloud-config file ntp.yaml

# start an lxc w/ ntp cloud-config user-data
$ lxc init ubuntu-daily:artful a1
$ lxc config set a2 user.user-data - < ntp.yaml
$ lxc start a2
$ lxc exec a2 -- grep -A 10 Traceback /var/log/cloud-init.log