Using owner with write_files in cloud config breaks

Bug #1231541 reported by Martin Packman
42
This bug affects 9 people
Affects Status Importance Assigned to Milestone
cloud-init
Confirmed
Medium
Unassigned

Bug Description

Setting the owner of a file injected with cc_write_files now breaks on raring and saucy, as the ubuntu is not found.

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/cloudinit/stages.py", line 578, in _run_modules
    cc.run(run_name, mod.handle, func_args, freq=freq)
  File "/usr/lib/python2.7/dist-packages/cloudinit/cloud.py", line 63, in run
    return self._runners.run(name, functor, args, freq, clear_on_fail)
  File "/usr/lib/python2.7/dist-packages/cloudinit/helpers.py", line 197, in run
    results = functor(*args)
  File "/usr/lib/python2.7/dist-packages/cloudinit/config/cc_write_files.py", line 38, in handle
    write_files(name, files, log)
  File "/usr/lib/python2.7/dist-packages/cloudinit/config/cc_write_files.py", line 77, in write_files
    util.chownbyname(path, u, g)
  File "/usr/lib/python2.7/dist-packages/cloudinit/util.py", line 1111, in chownbyname
    raise OSError("Unknown user or group: %s" % (e))
OSError: Unknown user or group: 'getpwnam(): name not found: ubuntu'

This is because the cc_write_files step happens very early, and before the cc_users_groups step, and current cloud images no longer include the ubuntu user.

Scott Moser (smoser)
Changed in cloud-init:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Lukas Vacek (lukas-vacek) wrote :

(2 years on and) the bug still affects cloud-init

cc_write_files should be run after the users have been set up

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.