datasource.sys_cfg gets different values in local stage and after.

Bug #1787459 reported by Scott Moser on 2018-08-16
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Medium
Scott Moser
cloud-init (Ubuntu)
Medium
Unassigned

Bug Description

When a datasource is instantiated it is passed in Init.cfg as the 'sys_cfg'.
But then when 'distro' property is referenced, it has the side effect
of:
            system_config = self._extract_cfg('system')

            if self.datasource is not NULL_DATA_SOURCE:
                self.datasource.distro = self._distro
                self.datasource.sys_cfg = system_config

Here we see the problem demonstrated.

root@c1:~# cat show-syscfg-keys
#!/usr/bin/python3
from cloudinit.stages import _pkl_load;
print(_pkl_load("/var/lib/cloud/instance/obj.pkl").sys_cfg.keys())

root@c1:~# cloud-init clean --logs
root@c1:~# cloud-init init --local
Cloud-init v. 18.3-18-g3cee0bf8-0ubuntu1 running 'init-local' at Thu, 16 Aug 2018 18:08:00 +0000. Up 574.00 seconds.

root@c1:~# python3 show-syscfg-keys
dict_keys(['datasource_list', '_log', 'log_cfgs', 'output', 'users', 'disable_root', 'preserve_hostname', 'cloud_init_modules', 'cloud_config_modules', 'cloud_final_modules', 'def_log_file', 'syslog_fix_perms', 'vendor_data'])

root@c1:~#
root@c1:~#
root@c1:~# cloud-init init >/dev/null 2>&1
Cloud-init v. 18.3-18-g3cee0bf8-0ubuntu1 running 'init' at Thu, 16 Aug 2018 18:08:11 +0000. Up 585.00 seconds.
...

root@c1:~# python3 show-syscfg-keys
dict_keys(['default_user', 'ntp_client', 'paths', 'package_mirrors', 'ssh_svcname', 'network'])

ProblemType: Bug
DistroRelease: Ubuntu 18.10
Package: cloud-init 18.3-18-g3cee0bf8-0ubuntu1
ProcVersionSignature: Ubuntu 4.17.0-6.7-generic 4.17.9
Uname: Linux 4.17.0-6-generic x86_64
ApportVersion: 2.20.10-0ubuntu7
Architecture: amd64
CloudName: LXD
Date: Thu Aug 16 18:02:03 2018
PackageArchitecture: all
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 LANG=C.UTF-8
SourcePackage: cloud-init
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Scott Moser (smoser) wrote :
Changed in cloud-init:
status: New → Confirmed
Changed in cloud-init (Ubuntu):
status: New → Confirmed
Changed in cloud-init:
importance: Undecided → Medium
Changed in cloud-init (Ubuntu):
importance: Undecided → Medium
Scott Moser (smoser) on 2018-09-16
Changed in cloud-init:
assignee: nobody → Scott Moser (smoser)

This bug is fixed with commit f0ff1940 to cloud-init on branch master.
To view that commit see the following URL:
https://git.launchpad.net/cloud-init/commit/?id=f0ff1940

Changed in cloud-init:
status: Confirmed → Fix Committed

This bug is believed to be fixed in cloud-init in version 18.4. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Fix Committed → Fix Released
Scott Moser (smoser) wrote :

This bug was fixed in the package cloud-init - 18.4-0ubuntu1
---------------

cloud-init (18.4-0ubuntu1) cosmic; urgency=medium

  * New upstream release.
    - release 18.4 (LP: #1795741)
    - tests: allow skipping an entire cloud_test without running.
    - tests: disable lxd tests on cosmic
    - cii-tests: use unittest2.SkipTest in ntp_chrony due to new deps
    - lxd: adjust to snap installed lxd.
    - docs: surface experimental doc in instance-data.json
    - tests: fix ec2 integration tests. process meta_data instead of meta-data
    - Add support for Infiniband network interfaces (IPoIB). [Mark Goddard]
    - cli: add cloud-init query subcommand to query instance metadata
    - tools/tox-venv: update for new features.
    - pylint: ignore warning assignment-from-no-return for _write_network
    - stages: Fix bug causing datasource to have incorrect sys_cfg.
      (LP: #1787459)
    - Remove dead-code _write_network distro implementations.
    - net_util: ensure static configs have netmask in translate_network result
      [Thomas Berger] (LP: #1792454)
    - Fall back to root:root on syslog permissions if other options fail.
      [Robert Schweikert]
    - tests: Add mock for util.get_hostname. [Robert Schweikert] (LP: #1792799)

 -- Chad Smith <email address hidden> Tue, 02 Oct 2018 19:55:23 -0600

Changed in cloud-init (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers