Validating xenial and zesty with the above script:
xenial START --------------
Creating xenial-proposed-123719471
...
The following packages will be upgraded:
  cloud-init
1 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
Need to get 324 kB of archives.
After this operation, 44.0 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial-proposed/main amd64 cloud-init 
all 0.7.9-233-ge586fe35-0ubuntu1~16.04.1 [324 kB]
...
Valid cloud-config file /valid.conf
Valid cloud-config file /invalid.conf
...
The following NEW packages will be installed:
  python3-jsonschema
# And we now can see schema errors when jsonschema is installed
Cloud config schema errors: ntp.pools: -1 is not of type 'array'


zesty START --------------
Creating zesty-proposed-34023523
...
The following packages will be upgraded:
  cloud-init
...
Get:1 http://archive.ubuntu.com/ubuntu zesty-proposed/main amd64 cloud-init all 
0.7.9-233-ge586fe35-0ubuntu1~17.04.1 [321 kB]
...
Creating test-zesty
Valid cloud-config file /valid.conf
Valid cloud-config file /invalid.conf
...
The following NEW packages will be installed:
  python3-jsonschema
# And we now can see schema errors when jsonschema is installed
Cloud config schema errors: ntp.pools: -1 is not of type 'array'



** Tags removed: verification-needed verification-needed-xenial 
verification-needed-zesty
** Tags added: verification-done-xenial verification-done-zesty

** Description changed:

  === Begin SRU Template ===
  [Impact]
  New feature to validate and log invalid schema warnings from cc_ntp 
cloud-config module.
  
  [Test Case]
  if [ ! -f lxc-proposed-snapshot ]; then
    wget 
https://git.launchpad.net/~smoser/cloud-init/+git/sru-info/plain/bin/lxc-proposed-snapshot
    chmod 755 lxc-proposed-snapshot
  fi
  
  
  cat <<EOF > valid.conf
  #cloud-config
  ntp:
  EOF
  cat <<EOF > invalid.conf
  #cloud-config
  ntp: -1
  EOF
  for release in xenial zesty; do
          ref=$release-proposed;
          echo "$release START --------------";
          ./lxc-proposed-snapshot --proposed --publish $release $ref;
          lxc init $ref test-$release;
          lxc start test-$release;
+         lxc sleep 10;
+         lxc exec test-$release -- sudo apt update;
          lxc file push valid.conf test-$release/valid.conf;
          lxc file push invalid.conf test-$release/invalid.conf;
          lxc exec test-$release -- python3 
/usr/lib/python3/dist-packages/cloudinit/config/schema.py -c /valid.conf | grep 
Valid;
          lxc exec test-$release -- apt-cache depends cloud-init | grep 
jsonschema # should be empty;
-         # Validate no errors without python-jsonschema
-         lxc exec test-$release -- python3 
/usr/lib/python3/dist-packages/cloudinit/config/schema.py -c /invalid.conf | 
grep errors;  # without jsonschema no errors
-         # Validate errors with python-jsonschema
+         # invalid.conf will not generate errors when jsonschema is not present
+         lxc exec test-$release -- python3 
/usr/lib/python3/dist-packages/cloudinit/config/schema.py -c /invalid.conf | 
grep invalid; 
          lxc exec test-$release -- sudo apt install python3-jsonschema
-         lxc exec test-$release -- python3 
/usr/lib/python3/dist-packages/cloudinit/config/schema.py -c /invalid.conf | 
grep errors;  # should have errors
- done
+         # invalid.conf *will* generate errors when jsonschema is not present
+          lxc exec test-$release -- python3 
/usr/lib/python3/dist-packages/cloudinit/config/schema.py -c /invalid.conf | 
grep invalid;
+ done;
  
  [Regression Potential]
  We don't want to introduce a mandatory jsonschema dependency in older series.
  Validate that older releases can run without errors when jsonschema is *not* 
installed.
  
  [Other Info]
  Upstream commit at
    https://git.launchpad.net/cloud-init/commit/?id=0a448dd034
  
  === End SRU Template ===
  
  cloudinit needs a mechanism to parse and validate a strict schema
  definition for modules that parse user created #cloud-config yaml files.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1692916

Title:
  Cloudinit modules should provide schema validation to better alert
  consumers to unsupported config

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

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to