Skip to content

Skip a vault-encrypted secure.yml in the CLI - #2963

Merged
berendt merged 1 commit into
mainfrom
ignore-vault-encrypted-secure-yml
Dec 1, 2026
Merged

berendt merged 1 commit into
mainfrom
ignore-vault-encrypted-secure-yml

Conversation

@ideaship

@ideaship ideaship commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

The osism CLI reads the OpenStack admin password from os_password_<cloud> in environments/openstack/secrets.yml. Without that secret it falls back to a legacy secure.yml, and it handed a vault-encrypted one to openstacksdk, which cannot read Ansible Vault. The command then failed with Configuration file … is empty or not a valid mapping, which mentions neither the encryption nor os_password_<cloud>.

The fallback now skips a vault-encrypted secure.yml/secure.yaml with a warning that points at os_password_<cloud>:

  • Without os_password_<cloud>, the command ends with the existing "No credentials found … Set 'os_password_'" error.
  • After an authentication failure, get_openstack_connection no longer retries against an encrypted file; it reports "Check 'os_password_'".
  • A plain-text secure.yml keeps working as before.

This matches how plays in the openstack environment treat an encrypted secure.yml since osism/container-image-osism-ansible#794.

Known gap, not addressed here: openstacksdk fixes its secure-file search path at import time. osism manage compute … imports it before the CLI switches to /tmp, so for those commands an encrypted /etc/openstack/secure.yml can still be read even when os_password_<cloud> is set. Fixing that means exporting OS_CLIENT_SECURE_FILE, as osism/container-image-osism-ansible#794 does, and it changes the retry fallback, so it is left for a separate change.

Related:

🤖 Generated with Claude Code

The osism CLI reads the OpenStack admin password from
os_password_<cloud> in environments/openstack/secrets.yml. If that
secret is missing, it falls back to a legacy /etc/openstack/secure.yml
(or secure.yaml) and copies it to /tmp for openstacksdk.

That fallback did not check the file's format. A secure.yml committed
vault-encrypted, like every other secret in the configuration
repository, was handed to openstacksdk, which cannot read Ansible
Vault. The command then failed with "Configuration file ... is empty
or not a valid mapping", which points neither at the encryption nor
at os_password_<cloud>.

A new helper, find_secure_file(), returns the first secure file that
is not vault-encrypted, detected by the $ANSIBLE_VAULT header, and
logs a warning for each encrypted one it skips. Both places that
consulted the fallback use it:

- setup_cloud_environment() treats an encrypted file as absent. Without
  os_password_<cloud>, the command now ends with the existing "No
  credentials found for cloud ... Set 'os_password_<cloud>' in
  .../secrets.yml" error.
- get_openstack_connection() no longer retries without the password
  override after Unauthorized when the only secure file is encrypted.
  It reports "Authentication failed ... Check 'os_password_<cloud>'"
  instead.

A plain-text secure.yml keeps working as a fallback, as before. The
osism-ansible run scripts treat an encrypted secure.yml the same way
for plays in the openstack environment.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Roger Luethi <luethi@osism.tech>
@ideaship ideaship self-assigned this Dec 1, 2026
@ideaship
ideaship marked this pull request as ready for review December 1, 2026 15:08
@ideaship
ideaship requested a review from berendt December 1, 2026 15:08
@berendt
berendt merged commit e1d20c8 into main Dec 1, 2026
3 checks passed
@berendt
berendt deleted the ignore-vault-encrypted-secure-yml branch December 1, 2026 15:13
@github-project-automation github-project-automation Bot moved this from New to Done in Human Board Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants