Skip to content

fix: [AAP-91811] replace is_defined guards with default('') for VSO secret support - #366

Open
sunalawa wants to merge 1 commit into
ansible:mainfrom
sunalawa:fix/AAP-91811-vso-guard-pattern
Open

sunalawa wants to merge 1 commit into
ansible:mainfrom
sunalawa:fix/AAP-91811-vso-guard-pattern

Conversation

@sunalawa

@sunalawa sunalawa commented Sep 16, 2026

Copy link
Copy Markdown

event_stream.database_secret and event_persistence.database_secret used
'is defined' guards which break when an empty-string default is added —
the same pattern fixed in galaxy-operator PR #283. Replaced with
'| default('') | length' so both undefined and '' are treated as unset,
allowing VSO-pre-created secrets to be correctly preserved on reconcile.

Ref: AAP-91811, ANSTRAT-2212
Signed-off-by: Suyash Nalawade sunalawa@redhat.com

Summary by CodeRabbit

  • Refactor
    • Simplified PostgreSQL configuration checks while preserving existing behavior.
    • Secret validation continues to run only when non-empty values are provided.
    • Tasks remain skipped when relevant secrets are missing or empty.

…ecret support

event_stream.database_secret and event_persistence.database_secret used
'is defined' guards which break when an empty-string default is added —
the same pattern fixed in galaxy-operator PR ansible#283. Replaced with
'| default('') | length' so both undefined and '' are treated as unset,
allowing VSO-pre-created secrets to be correctly preserved on reconcile.

Ref: AAP-91811, ANSTRAT-2212
Signed-off-by: Suyash Nalawade <sunalawa@redhat.com>
@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: e0c2df93-ed39-4a5d-9931-aa0f38f91083

📥 Commits

Reviewing files that changed from the base of the PR and between a4646fc and 24f6a88.

📒 Files selected for processing (3)
  • roles/postgres/tasks/main.yml
  • roles/postgres/tasks/set_event_persistence_secret.yml
  • roles/postgres/tasks/set_event_stream_secret.yml

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The PostgreSQL role replaces explicit secret-definedness and length checks with default('') and truthiness expressions. The updated conditions preserve existing behavior for undefined, empty, and non-empty secrets.

Changes

PostgreSQL secret guard simplification

Layer / File(s) Summary
Simplify PostgreSQL secret conditions
roles/postgres/tasks/main.yml, roles/postgres/tasks/set_event_stream_secret.yml, roles/postgres/tasks/set_event_persistence_secret.yml
The event stream and event persistence task guards now use defaulted secret lengths or truthiness checks. Undefined and empty secrets produce the same task decisions as before.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 24f6a

No concrete merge-blocking risk is established by the available evidence.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: replacing is_defined guards with default('') for VSO secret support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Git: CodeRabbit could not clone the repository, so clone-backed analysis was skipped and this review may be incomplete. Verify repository clone access, such as SSH credentials, before requesting another full review. If clone access is intentionally unavailable, use path_filters to narrow the review scope.


Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

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