[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1040979: write_files: defer not working any more



Control: tags -1 + moreinfo

On Thu, Jul 13, 2023 at 05:30:52PM +0200, Sven Strickroth wrote:
> starting with the shipped version in Debian 12 the write_files feature with defer option does not work any more.

I'm not able to reproduce the behavior you describe.  defer seems to
work as expected.  For example:

admin@ip-10-0-0-87:~$ ec2-metadata --ami-id
ami-id: ami-0544719b13af6edc3
admin@ip-10-0-0-87:~$ sudo cat /var/lib/cloud/instance/user-data.txt
#cloud-config
write_files:
- content: |
    testing. this file should be owned by the dynamically created user
  path: /test-file
  owner: admin:admin
  defer: true
admin@ip-10-0-0-87:~$ ls -l /test-file 
-rw-r--r-- 1 admin admin 67 Jul 13 16:59 /test-file

And in /var/log/cloud-init.log we see it being handled as expected:
2023-07-13 16:59:53,893 - modules.py[DEBUG]: Running module write-files-deferred (<module 'cloudinit.config.cc_write_files_deferred' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_write_files_deferred.py'>) with frequency once-per-instance
2023-07-13 16:59:53,893 - handlers.py[DEBUG]: start: modules-final/config-write-files-deferred: running config-write-files-deferred with frequency once-per-instance
2023-07-13 16:59:53,893 - util.py[DEBUG]: Writing to /var/lib/cloud/instances/i-016aa1a2f2e89c783/sem/config_write_files_deferred - wb: [644] 24 bytes
2023-07-13 16:59:53,893 - helpers.py[DEBUG]: Running config-write-files-deferred using lock (<FileLock using file '/var/lib/cloud/instances/i-016aa1a2f2e89c783/sem/config_write_files_deferred'>)
2023-07-13 16:59:53,893 - util.py[DEBUG]: Writing to /test-file - wb: [644] 67 bytes
2023-07-13 16:59:53,894 - util.py[DEBUG]: Changing the ownership of /test-file to 1000:1001
2023-07-13 16:59:53,894 - handlers.py[DEBUG]: finish: modules-final/config-write-files-deferred: SUCCESS: config-write-files-deferred ran successfully

I note that your cloud-config attempts to set the locale:

> #cloud-config
> locale: de_DE.UTF-8

I suspect that that's failing (see #955733) and interfering with
subsequent module execution.  If you remove the `locale` setting, does
your userdata work as expected?

noah


Reply to: