Skip to content

Fix: rotate_secrets exits prematurely during deployment#523

Open
itsouvalas wants to merge 1 commit intov3.1.x-devfrom
fix/rotate-secrets-exit-during-deploy
Open

Fix: rotate_secrets exits prematurely during deployment#523
itsouvalas wants to merge 1 commit intov3.1.x-devfrom
fix/rotate-secrets-exit-during-deploy

Conversation

@itsouvalas
Copy link

Description

Fixes a bug where genesis deploy exits prematurely when no secrets are defined in the kit.

Problem

When rotate_secrets() is called internally during deployment (via _fix_secrets()), it calls exit 0 if no secrets are found, terminating the entire Genesis process before BOSH deployment can occur.

Root Cause

The bug was introduced in commit 8ae11b0 (May 2025) when deployment preflight checks were enhanced. The rotate_secrets() method was originally designed as a command handler that could safely exit, but is now also used as an internal method during deployment that must return values to its caller.

Solution

Changed exit 0 to return ({empty => 1}) to match the pattern used by other secret-related methods (add_secrets, remove_secrets), allowing _fix_secrets() to properly handle the empty secrets case as a success condition.

Testing

  • Tested with jumpbox-genesis-kit without openvpn feature (no secrets defined)
  • Deployment now proceeds normally instead of exiting early
  • Message "doesn't have any secrets to rotate" still appears but deployment continues

Impact

  • Minimal change (1 line)
  • Fixes deployments for any kit with optional secrets or no secrets at all
  • No breaking changes - maintains same behavior for rotate-secrets command

When rotate_secrets() is called during deployment via _fix_secrets(),
it would exit the entire Genesis process if no secrets were defined,
causing deployments to fail silently.

This bug was introduced in commit 8ae11b0 (May 2025) when _fix_secrets()
was added as part of the deployment preflight checks enhancement. The
rotate_secrets() method was originally designed as a command handler
that could safely exit, but is now also used as an internal method that
must return values to its caller.

Changed exit 0 to return ({empty => 1}) to match the pattern used by
other secret-related methods (add_secrets, remove_secrets) and allow
_fix_secrets() to properly handle the empty secrets case.

Fixes deployment failures for kits with no secrets defined (e.g.,
jumpbox-genesis-kit without openvpn feature enabled).
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