netOrk moves its own account on a host from its installation-wide key to the key of the host's site (NetOrk/netork#2462: one system key per site, so a satellite holds a login for its own site's hosts only). The old key then has to come off the account. remove_local_account_keys cannot do that: it refuses the login user's own account and system accounts (uid < 1000), and netOrk's account is both.
Change
add_service_account(name, public_key, *, uid=None, replaces=()): the keys in replaces go from the account once public_key is in it, as a step old keys, matched by their base64 as in add_local_account. public_key itself never goes, and while it could not be added the old keys stay, so netOrk keeps its way in. netOrk calls it through a login with the new key, after trying that login.
Tests
tests/test_service_account.py: a replaced key goes once the new one is in; the new key is never one that goes; a replaced key stays while the new one could not be added; replaces must be a list, not one string. The full suite passes (1641 passed, 3 skipped); ruff and mypy are clean.
CHANGELOG: under Unreleased. NetOrk/netork pins this branch's commit (6795847) in the PR for #2462. A merge commit keeps that SHA reachable.
## What and why
netOrk moves its own account on a host from its installation-wide key to the key of the host's site (NetOrk/netork#2462: one system key per site, so a satellite holds a login for its own site's hosts only). The old key then has to come off the account. `remove_local_account_keys` cannot do that: it refuses the login user's own account and system accounts (uid < 1000), and netOrk's account is both.
## Change
`add_service_account(name, public_key, *, uid=None, replaces=())`: the keys in `replaces` go from the account once `public_key` is in it, as a step `old keys`, matched by their base64 as in `add_local_account`. `public_key` itself never goes, and while it could not be added the old keys stay, so netOrk keeps its way in. netOrk calls it through a login with the new key, after trying that login.
## Tests
`tests/test_service_account.py`: a replaced key goes once the new one is in; the new key is never one that goes; a replaced key stays while the new one could not be added; `replaces` must be a list, not one string. The full suite passes (1641 passed, 3 skipped); ruff and mypy are clean.
CHANGELOG: under Unreleased. NetOrk/netork pins this branch's commit (6795847) in the PR for #2462. A merge commit keeps that SHA reachable.
netOrk moves a host from its installation-wide key to its site's
(NetOrk/netork#2462): the old key has to go from its own account, which
remove_local_account_keys refuses (the login's own account, a system
account). With replaces, the old keys go once the new key is in -- never
the new key itself, and not while it could not be added.
replaces= made add_service_account 55 lines long, over the quality
ratchet's 50. Its account step -- none to take when the driver logs in
as the account already, else the create or reopen -- moves to
_accounts_service_account_step. Behaviour is unchanged; the tests of
add_service_account cover both branches.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What and why
netOrk moves its own account on a host from its installation-wide key to the key of the host's site (NetOrk/netork#2462: one system key per site, so a satellite holds a login for its own site's hosts only). The old key then has to come off the account.
remove_local_account_keyscannot do that: it refuses the login user's own account and system accounts (uid < 1000), and netOrk's account is both.Change
add_service_account(name, public_key, *, uid=None, replaces=()): the keys inreplacesgo from the account oncepublic_keyis in it, as a stepold keys, matched by their base64 as inadd_local_account.public_keyitself never goes, and while it could not be added the old keys stay, so netOrk keeps its way in. netOrk calls it through a login with the new key, after trying that login.Tests
tests/test_service_account.py: a replaced key goes once the new one is in; the new key is never one that goes; a replaced key stays while the new one could not be added;replacesmust be a list, not one string. The full suite passes (1641 passed, 3 skipped); ruff and mypy are clean.CHANGELOG: under Unreleased. NetOrk/netork pins this branch's commit (
6795847) in the PR for #2462. A merge commit keeps that SHA reachable.