Skip to content

Commit

Permalink
Deprecate the users ssh-authorized-keys property
Browse files Browse the repository at this point in the history
The previous cloud-config still works without any issues,
but it doesn't pass validation - not even as deprecated.

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
  • Loading branch information
afbjorklund committed Apr 19, 2024
1 parent 7bd67fb commit a5fe268
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cloudinit/config/schemas/schema-cloud-config-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,22 @@
},
"minItems": 1
},
"ssh-authorized-keys": {
"allOf": [
{
"type": "array",
"items": {
"type": "string"
},
"minItems": 1
},
{
"deprecated": true,
"deprecated_version": "18.3",
"deprecated_description": "Use ``ssh_authorized_keys`` instead."
}
]
},
"ssh_import_id": {
"description": "List of ssh ids to import for user. Can not be combined with ``ssh_redirect_user``. See the man page[1] for more details. [1] https://manpages.ubuntu.com/manpages/noble/en/man1/ssh-import-id.1.html",
"type": "array",
Expand Down
30 changes: 30 additions & 0 deletions tests/unittests/config/test_cc_users_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,36 @@ class TestUsersGroupsSchema:
),
True,
),
(
{
"users": [
{
"name": "lima",
"uid": "1000",
"homedir": "/home/lima.linux",
"shell": "/bin/bash",
"sudo": "ALL=(ALL) NOPASSWD:ALL",
"lock_passwd": True,
"ssh-authorized-keys": ["ssh-ed25519 ..."],
}
]
},
pytest.raises(
SchemaValidationError,
match=(
"Cloud config schema deprecations: "
"users.0.ssh-authorized-keys: "
" Deprecated in version 18.3."
" Use ``ssh_authorized_keys`` instead."
", "
"users.0.uid: "
" Changed in version 22.3."
" The use of ``string`` type is deprecated."
" Use an ``integer`` instead."
),
),
False,
),
],
)
@skipUnlessJsonSchema()
Expand Down

0 comments on commit a5fe268

Please sign in to comment.