Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sugar for creating containing directories with specified ownership/perms #380

Open
bgilbert opened this issue Aug 9, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request jira sugar Issue related to config sugar

Comments

@bgilbert
Copy link
Contributor

bgilbert commented Aug 9, 2022

Ignition creates containing directories for files/dirs/links specified in the config, but it gives them default ownership/permissions rather than the ones specified for the file/dir/link. This ensures that containing directories have safe default ownership. It's still possible to override the parents' ownership/perms by explicitly specifying the containing directories in the directories section.

But it's not especially ergonomic. A deeply-nested file might need several containing directories, each of which needs to be spelled out explicitly. This makes sense for Ignition configs, which are intentionally low-level, but it'd be nice to have Butane sugar to avoid this.

The main issue here will be syntax. Butane doesn't know which directories already exist, and we can't override perms on every containing directory all the way up to the root. For example, if creating /home/builder/.config/systemd/user/default.target.wants/something.service, we might want to set ownership for builder/.config/systemd/user/default.target.wants but not /home. I don't think the ecosystem has a conventional syntax for this.

We could do something like this:

variant: fcos
version: 1.5.0-experimental
storage:
  files:
    - path: /home/builder/.config/systemd/user/default.target.wants/something.service
      user:
        name: builder
      contents:
        inline: invalid
  directories:
    - path: /home/builder/.config/systemd/user/default.target.wants
      base: /home
      user:
        name: builder

That has the disadvantages of being verbose and difficult to understand.

We could merge the "parent directories" fields into the files/directories/links sections, but we can't reuse a file mode as a directory mode, so we might want another field or so:

variant: fcos
version: 1.5.0-experimental
storage:
  files:
    - path: /home/builder/.config/systemd/user/default.target.wants/something.service
      user:
        name: builder
      contents:
        inline: invalid
      parents:
        base: /home
        mode: 0700

Discussion thread

@bgilbert bgilbert added the enhancement New feature or request label Aug 9, 2022
@bgilbert bgilbert added sugar Issue related to config sugar jira labels Jan 10, 2023
@prestist prestist self-assigned this Aug 14, 2023
prestist added a commit to prestist/butane that referenced this issue Mar 14, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 17, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 18, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 18, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 18, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 18, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 18, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 18, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 19, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 19, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 19, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 20, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 20, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 20, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 21, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 24, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 24, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 24, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 24, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 26, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 26, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jun 26, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jul 2, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jul 2, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jul 2, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jul 4, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jul 4, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jul 4, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jul 4, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jul 4, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jul 4, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jul 5, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jul 5, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
yasminvalim added a commit to prestist/butane that referenced this issue Jul 5, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
prestist added a commit to prestist/butane that referenced this issue Jul 18, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
Co-authored-by: Luke Yang <[email protected]>
Co-authored-by: Renata Ravanelli <[email protected]>
Co-authored-by: Huijing Hei <[email protected]>
prestist added a commit to prestist/butane that referenced this issue Jul 18, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
Co-authored-by: Luke Yang <[email protected]>
Co-authored-by: Renata Ravanelli <[email protected]>
Co-authored-by: Huijing Hei <[email protected]>
prestist added a commit to prestist/butane that referenced this issue Jul 19, 2024
Add a field called 'Parent' which is used to specify a file's parent
directory. When a parent is specified, all directories from the parent to
the file will be created, with the 'mode' supplied in the parent directory.

resolves: coreos#380

Co-authored-by: Yasmin Valim  <[email protected]>
Co-authored-by: Joseph Corchado <[email protected]>
Co-authored-by: Adam Piasecki <[email protected]>
Co-authored-by: Luke Yang <[email protected]>
Co-authored-by: Renata Ravanelli <[email protected]>
Co-authored-by: Huijing Hei <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request jira sugar Issue related to config sugar
Projects
None yet
Development

No branches or pull requests

2 participants