Comment 0 for bug 1976564

Revision history for this message
Chad Smith (chad.smith) wrote : cloud-config: cloud_dir setting not honored globalling by cloud-init

Changes to /etc/cloud/cloud.cfg system_info: paths: cloud_dir setting is not honored globally in cloud-init. Some paths continue to hardcode /var/lib/cloud paths to certain operations.

Affects cloud-init version 22.2

[Test Plan]

cat > 95-custom-cloud-dir.cfg <<EOF
system_info:
   paths:
      cloud_dir: /new-cloud-dir
EOF
lxc launch ubuntu-daily:kinetic dev-k
lxc file push 95-custom-cloud-dir.cfg dev-k/etc/cloud/cloud.cfg.d/
lx exec dev-x -- rm -rf /var/lib/cloud
lxc exec dev-k -- cloud-init clean --logs --reboot
lxc exec dev-k -- cloud-init status --wait --long

# Expect not logs talking about using /var/lib/cloud
lxc exec dev-k -- grep /var/lib /var/log/cloud-init.log
2022-06-01 23:18:07,234 - atomic_helper.py[DEBUG]: Atomically writing to file /var/lib/cloud/data/status.json (via temporary file /var/lib/cloud/data/tmpqwldn_op) - w: [644] 486 bytes/chars
2022-06-01 23:18:08,642 - atomic_helper.py[DEBUG]: Atomically writing to file /var/lib/cloud/data/status.json (via temporary file /var/lib/cloud/data/tmpy7wm60kf) - w: [644] 512 bytes/chars
2022-06-01 23:18:13,156 - atomic_helper.py[DEBUG]: Atomically writing to file /var/lib/cloud/data/status.json (via temporary file /var/lib/cloud/data/tmpvw2y443q) - w: [644] 540 bytes/chars
2022-06-01 23:18:13,996 - atomic_helper.py[DEBUG]: Atomically writing to file /var/lib/cloud/data/status.json (via temporary file /var/lib/cloud/data/tmpdzbb4lu7) - w: [644] 567 bytes/chars
2022-06-01 23:18:13,996 - atomic_helper.py[DEBUG]: Atomically writing to file /var/lib/cloud/data/result.json (via temporary file /var/lib/cloud/data/tmpecr955s_) - w: [644] 64 bytes/chars
2022-06-01 23:18:13,996 - util.py[DEBUG]: Creating symbolic link from '/run/cloud-init/result.json' => '../../var/lib/cloud/data/result.json'

# Expect to find no files in /var/lib/cloud
lxc exec dev-x find /var/lib/cloud
/var/lib/cloud
/var/lib/cloud/data
/var/lib/cloud/data/status.json

[ Possible hardcoded paths to resolve]
- cloudinit/util.py:fetch_ssl_details
- cloudinit/sources/DataSourceBigstep.py
- cloudinit/sources/DataSourceAzure.py
- cloudinit/cmd/main.py:status_wrapper
- cloudinit/cmd/devel/logs.py

-