Repository navigation
baremetal: Warn when first boot installs no key - #2934
Merged
Merged
Conversation
The first-boot play that osism baremetal deploy puts on a node's config drive installs the operator keys through the operator role of osism.commons, from operator_authorized_keys, operator_additional_authorized_keys and operator_authorized_github_accounts. When the play carries none of them, the deploy goes on and the node is installed without a key. That happens when NetBox is not configured for the client, when the NetBox lookup fails, when no device matches the node, or when the device carries none of the three in first_boot or local_context_data. Today the keys baked into the osism-node image hide this: the node is reachable anyway. Without them it is active but unreachable, and the first sign is wait-for-connection timing out on the manager. osism baremetal deploy, dump --ironic and the NetBox-mode dump now log a warning per node in that case, naming the node and the reason: node101: the first boot installs no operator key (<reason>). After the deploy the node is reachable only through credentials built into the image, if it has any. The code cannot tell what the image contains, so the warning only states what NetBox provides. It fires for every node whose NetBox data carries no operator key. Sites that keep operator_authorized_keys in the device's local_context_data, as the key rotation guide describes, or one of the three under first_boot, do not see it. Deploy behaviour and exit status are unchanged. The NetBox lookup, which deploy and dump --ironic carried as identical copies, moves into _lookup_netbox_device, which returns the device or the reason it has none; the existing "Failed to fetch NetBox data" warning stays. The NetBox-mode dump already fails when NetBox or the device is missing, so there the warning can only report a device without a key. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Roger Luethi <luethi@osism.tech>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
osism baremetal deploy,osism baremetal dump --ironicand the NetBox-modeosism baremetal dumplog a warning per node when the first-boot play carries no operator key, naming the node and the reason:inventory_hostname)operator_authorized_keys,operator_additional_authorized_keysandoperator_authorized_github_accountsinfirst_bootorlocal_context_dataFor example:
Why
The first-boot play installs the operator keys through the operator role of osism.commons, from those three variables. When the play carries none of them, the deploy goes on and the node is installed without a key. Today the keys built into the osism-node image hide this, because the node is reachable anyway. Without them the node is
activebut unreachable, and the first sign iswait-for-connectiontiming out on the manager.The code cannot tell what the image contains, so the warning only states what NetBox provides. It fires for every node whose NetBox data carries no operator key. Sites that keep
operator_authorized_keysin the device'slocal_context_data, as the key rotation guide describes, or one of the three underfirst_boot, do not see it.Behaviour
Deploy behaviour and exit status are unchanged. The NetBox lookup, which
deployanddump --ironiccarried as identical copies, moves into_lookup_netbox_device, which returns the device or the reason it has none; the existing "Failed to fetch NetBox data" warning stays. The NetBox-modedumpalready fails when NetBox or the device is missing, so there the warning can only report a device without a key.Testing
tests/unit/commands/test_baremetal.py: every reason fordeployanddump --ironic, a device without a key for the NetBox-modedump, no warning for each of the three key variables and for a key at the top level, a warning for an empty or null key list underfirst_boot,deploy --allwith one node without a key, a lookup error indump --ironic, and the device name in the reason when the device is found byinventory_hostname.Permission denied (publickey)); bothdumpmodes logged the same warning.🤖 Generated with Claude Code