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

From https://cloudinit.readthedocs.io/en/latest/topics/modules.html#ntp

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

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/stages.py", line 793, in _run_modules
    freq=freq)
  File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 54, in run
    return self._runners.run(name, functor, args, freq, clear_on_fail)
  File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 187, in run
    results = functor(*args)
  File "/usr/lib/python3/dist-packages/cloudinit/config/cc_ntp.py", 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
#cloud-config
ntp:
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

Ste