SecretsManager - support ignore flag to noop if already exists#2457
Conversation
Reviewer's GuideAdds an IgnoreIfExists option to the SecretsManager.Store method, enforces mutual exclusivity with the existing Replace option, and updates Store logic to no-op when ignoring an already existing secret; test coverage is added for these scenarios. Class diagram for updated StoreOptions and SecretsManager.StoreclassDiagram
class StoreOptions {
map~string, string~ Labels
bool Replace
bool IgnoreIfExists
}
class SecretsManager {
Store(name string, data []byte, driverType string, options StoreOptions) (string, error)
}
SecretsManager --> StoreOptions : uses
Flow diagram for SecretsManager.Store logic with IgnoreIfExists and Replaceflowchart TD
A[Start Store] --> B{Data size valid?}
B -- No --> Z[Return errDataSize]
B -- Yes --> C{IgnoreIfExists && Replace?}
C -- Yes --> Y[Return errIgnoreIfExistsAndReplace]
C -- No --> D{Secret exists?}
D -- No --> E[Create new Secret]
D -- Yes --> F{Replace or IgnoreIfExists?}
F -- No --> G[Return errSecretNameInUse]
F -- IgnoreIfExists --> H[Return existing Secret ID]
F -- Replace --> I[Update existing Secret]
E --> J[Return new Secret ID]
I --> J
H --> J
G --> J
Y --> J
Z --> J
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
5baf72d to
e5e3f5e
Compare
|
Ephemeral COPR build failed. @containers/packit-build please check. |
1 similar comment
|
Ephemeral COPR build failed. @containers/packit-build please check. |
|
@Luap99 this is the PR to complement: podman-container-tools/podman#26467 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Luap99, sourcery-ai[bot], ygalblum The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@contaers/maintainers PTAL |
|
@containers/common-maintainers PTAL |
|
/lgtm |
Summary by Sourcery
Enhance SecretsManager.Store to support an ignore-if-exists flag with proper validation and add corresponding tests
New Features:
Bug Fixes:
Enhancements:
Tests: