Skip to content

Add psi install --stdout for container-mode token rotation#24

Merged
jdoss merged 1 commit intomasterfrom
feat/install-stdout-flag
Apr 9, 2026
Merged

Add psi install --stdout for container-mode token rotation#24
jdoss merged 1 commit intomasterfrom
feat/install-stdout-flag

Conversation

@jdoss
Copy link
Copy Markdown
Contributor

@jdoss jdoss commented Apr 9, 2026

Summary

  • psi install gains a --stdout flag that prints the rendered containers.conf.d/psi.conf to stdout instead of writing it. Container-mode deployments now have a working path for the README's documented token rotation procedure:

    sudo podman exec psi-secrets psi install --stdout \
      | sudo tee /etc/containers/containers.conf.d/psi.conf > /dev/null
  • New render_driver_conf() helper is side-effect-free — it does not create state_dir or touch the filesystem. The existing install_driver_conf() write path is unchanged.

  • README updated in two places: the "Install the shell driver" section now includes the container-mode one-liner, and the "Token rotation" step 3 points at it.

Why

In container mode, psi install inside the PSI container writes to the container's own /etc/containers/containers.conf.d/, which the host never sees. The documented rotation procedure ("re-run psi install") silently no-ops on the host. The only workaround was a manual podman cp dance. A full fix via bind-mounting the host's containers.conf.d/ into the container is tracked separately (SELinux label risk on FCOS needs hardware testing); this PR unblocks the rotation UX today with zero new privilege and zero SELinux changes.

Test plan

  • pytest tests/test_installer.py — new TestRenderDriverConf class: no-token, with-token (Authorization: Bearer header), and a regression test asserting render_driver_conf() never creates conf_dir or state_dir.
  • pytest tests/test_install_cli.py — new: psi install --stdout calls render_driver_conf and prints the result; psi install (no flag) still calls install_driver_conf.
  • ruff check / ruff format --check / ty check — all clean.

In container mode, `psi install` writes containers.conf.d/psi.conf to
the container's filesystem, not the host's, so the README's documented
token rotation procedure ("re-run psi install") silently no-ops on the
host. The only workaround was a manual podman cp dance.

Add a --stdout flag that prints the rendered driver conf instead of
writing it. Container deployments pipe it to the host file:

  podman exec psi-secrets psi install --stdout \
    | sudo tee /etc/containers/containers.conf.d/psi.conf > /dev/null

The new render_driver_conf() helper is side-effect-free — it does not
create state_dir or touch the filesystem, since the caller is
explicitly asking for bytes.

Update the FCOS install section and the token rotation section of the
README to document the container-mode one-liner.
@jdoss jdoss merged commit ae1678d into master Apr 9, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant