← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1990513] [NEW] write_files defer not using ownership for new folders

 

Public bug reported:

I would like to point out what I consider is a bug.
If the folder where the file is created exists, the file is created with the appropriate ownership. However if it doesn't exists, the file is created with the proper ownership while the folder is with root ownership.

In my case the default user is called ubuntu ;)

write_files:
  - path: /home/ubuntu/.help/file-in.txt
    content: |
      hi in
    owner: 'ubuntu:ubuntu'
    permissions: '0644'
    defer: true
  - path: /home/ubuntu/file-out.txt
    content: |
      hi out
    owner: 'ubuntu:ubuntu'
    permissions: '0644'
    defer: true

After running everthing:

ubuntu@mycomputer:~$ ls -alrt file.out
-rw-r--r-- 5 ubuntu ubuntu      6 Sep  22 10:44 file-out.txt
ubuntu@mycomputer:~$ ls -alrt .help
drwxr-xr-x 3 root   root     4096 Sep  22 2022 .help
ubuntu@mycomputer:~$ ls -alrt .help/file-in.txt
-rw-r--r-- 5 ubuntu ubuntu      7 Sep  22 10:44 file-out.txt

I guess the correct way should be to inherit the ownership for the
folder as well, unless pointed out in another way.

What do you think?

** Affects: cloud-init
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1990513

Title:
  write_files defer not using ownership for new folders

Status in cloud-init:
  New

Bug description:
  I would like to point out what I consider is a bug.
  If the folder where the file is created exists, the file is created with the appropriate ownership. However if it doesn't exists, the file is created with the proper ownership while the folder is with root ownership.

  In my case the default user is called ubuntu ;)

  write_files:
    - path: /home/ubuntu/.help/file-in.txt
      content: |
        hi in
      owner: 'ubuntu:ubuntu'
      permissions: '0644'
      defer: true
    - path: /home/ubuntu/file-out.txt
      content: |
        hi out
      owner: 'ubuntu:ubuntu'
      permissions: '0644'
      defer: true

  After running everthing:

  ubuntu@mycomputer:~$ ls -alrt file.out
  -rw-r--r-- 5 ubuntu ubuntu      6 Sep  22 10:44 file-out.txt
  ubuntu@mycomputer:~$ ls -alrt .help
  drwxr-xr-x 3 root   root     4096 Sep  22 2022 .help
  ubuntu@mycomputer:~$ ls -alrt .help/file-in.txt
  -rw-r--r-- 5 ubuntu ubuntu      7 Sep  22 10:44 file-out.txt

  I guess the correct way should be to inherit the ownership for the
  folder as well, unless pointed out in another way.

  What do you think?

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1990513/+subscriptions



Follow ups