canonical / canonical/cloud-init

User/Group keys with dashes not included in schema

Open
#5,187 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
2d 23h
Merged PRs (30d)
18

Description

# Bug report

Due to some [unfortunate old code](https://github.com/canonical/cloud-init/blob/9bcb3dce9d7abfbb7273e313d5056eda0424108f/cloudinit/distros/ug_util.py#L114), every users/groups key in our user data allows for both underscores and dashes. For example, if we define the key as `ssh_authorized_keys`, then `ssh-authorized-keys` is also valid.

The schema for all of the [user and group properties](https://github.com/canonical/cloud-init/blob/9bcb3dce9d7abfbb7273e313d5056eda0424108f/cloudinit/config/schemas/schema-cloud-config-v1.json#L213) contains the `_` version of the key but not the `-` version. The schema needs to be updated to allow both while specifying that the `-` version is deprecated.

https://github.com/canonical/cloud-init/pull/5162 already does this for `ssh-authorized-keys`, but we should do it for the remaining keys to be consistent.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.