← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1724951] [NEW] Ntp schema definition permits empty ntp cloud-config, but code disallows

 

Public bug reported:

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


Integration tests also present schema Warnings about invalid ntp pools and servers cloud-config yaml containing dict objects instead of lists.

** Affects: cloud-init
     Importance: Medium
     Assignee: Chad Smith (chad.smith)
         Status: In Progress

** Changed in: cloud-init
       Status: New => In Progress

** Changed in: cloud-init
   Importance: Undecided => Medium

** Changed in: cloud-init
     Assignee: (unassigned) => Chad Smith (chad.smith)

** Description changed:

  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.
- 
+ 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))
+   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
+ Integration tests also present schema Warnings about invalid ntp pools and servers cloud-config yaml containing dict objects instead of lists.

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1724951

Title:
  Ntp schema definition permits empty ntp cloud-config, but code
  disallows

Status in cloud-init:
  In Progress

Bug description:
  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

  
  Integration tests also present schema Warnings about invalid ntp pools and servers cloud-config yaml containing dict objects instead of lists.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1724951/+subscriptions


Follow ups