Skip to content

write_files runs before users/groups, renders "owner" useless #2573

@ubuntu-server-builder

Description

@ubuntu-server-builder

This bug was originally filed in Launchpad as LP: #1486113

Launchpad details
affected_projects = []
assignee = None
assignee_name = None
date_closed = 2023-03-23T19:47:09.488638+00:00
date_created = 2015-08-18T15:49:28.532879+00:00
date_fix_committed = 2023-03-23T19:47:09.488638+00:00
date_fix_released = 2023-03-23T19:47:09.488638+00:00
id = 1486113
importance = medium
is_complete = True
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1486113
milestone = None
owner = minfrin-y
owner_name = Graham Leggett
private = False
status = fix_released
submitter = minfrin-y
submitter_name = Graham Leggett
tags = []
duplicates = [1231541, 1745978, 1781549, 1942152]

Launchpad user Graham Leggett(minfrin-y) wrote on 2015-08-18T15:49:28.532879+00:00

When the following cloud-init script is run the expectation is that a group called ssl-cert-client is created, and this group is applied to the file that is written via the "owner" tag.

groups:

  • ssl-cert-server
  • ssl-cert-client
    write_files:
  • encoding: gzip
    content: !!binary |
    $(echo ${rsa_client_private_key} | gzip - | openssl base64 | sed -e "s/^/ /")
    owner: root:ssl-cert-client
    path: /etc/ssl/certs/${resourcegroup}-${machine}.${domain}-client.key
    permissions: '0640'

What happens instead is that the writing of the file is attempted before the creation of the group, and this file write fails because the group ssl-cert-server does not yet exist.

The two tasks need to be swapped round before they are practically useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    launchpadMigrated from Launchpad

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions