From 6701b7428483f5791f76a29d9a20ea5d3c0f9cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D7=A0=CF=85=CE=B1=CE=B7=20=D7=A0=CF=85=CE=B1=CE=B7=D1=95?= =?UTF-8?q?=CF=83=CE=B7?= Date: Fri, 27 Nov 2026 16:50:57 -0800 Subject: [PATCH] fix(controller): create a missing signing key osapi#1708 makes secret update of a key that is not there a 404, and adds secret create. The vault task creates a key that the vault does not hold, and updates a key with a different value. Co-Authored-By: Claude Opus 5.5 --- ansible/roles/controller/tasks/vault.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ansible/roles/controller/tasks/vault.yml b/ansible/roles/controller/tasks/vault.yml index f9026b5..3872663 100644 --- a/ansible/roles/controller/tasks/vault.yml +++ b/ansible/roles/controller/tasks/vault.yml @@ -1,6 +1,6 @@ --- # Keeps the lab's signing keys in the controller's vault, as a person would -# with osapi client secret update, and the config refers to them there +# with osapi client secret create, and the config refers to them there # (osapi-io/osapi-lab#54). The controller resolves the references at its # start. The first run starts it with the keys themselves, writes them, and # then starts it again on the references. A NATS password and a vault key @@ -20,10 +20,14 @@ check_mode: false no_log: true +# A key that the vault does not hold is a create. A key with a different +# value is an update, because a create of a key that exists with a different +# value is refused with 409. - name: Write each signing key that the vault does not hold ansible.builtin.command: argv: >- - {{ lab_hub_cli + ['client', 'secret', 'update', '--vault', lab_vault, + {{ lab_hub_cli + ['client', 'secret', 'create' if item.rc != 0 else 'update', + '--vault', lab_vault, '--key', lab_vault_signing_key_prefix ~ item.item.id, '--value', '-'] }} stdin: "{{ item.item.key }}" loop: "{{ controller_vault_keys.results }}"