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
-
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 daily:kinetic dev-k cloud-dir. cfg dev-k/etc/ cloud/cloud. cfg.d/
system_info:
paths:
cloud_dir: /new-cloud-dir
EOF
lxc launch ubuntu-
lxc file push 95-custom-
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 cloud-init. log 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 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 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 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 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 init/result. json' => '../../ var/lib/ cloud/data/ result. json'
lxc exec dev-k -- grep /var/lib /var/log/
2022-06-01 23:18:07,234 - atomic_
2022-06-01 23:18:08,642 - atomic_
2022-06-01 23:18:13,156 - atomic_
2022-06-01 23:18:13,996 - atomic_
2022-06-01 23:18:13,996 - atomic_
2022-06-01 23:18:13,996 - util.py[DEBUG]: Creating symbolic link from '/run/cloud-
# Expect to find no files in /var/lib/cloud cloud/data/ status. json
lxc exec dev-x find /var/lib/cloud
/var/lib/cloud
/var/lib/cloud/data
/var/lib/
[ Possible hardcoded paths to resolve] util.py: fetch_ssl_ details sources/ DataSourceBigst ep.py sources/ DataSourceAzure .py cmd/main. py:status_ wrapper cmd/devel/ logs.py
- cloudinit/
- cloudinit/
- cloudinit/
- cloudinit/
- cloudinit/
-