-
Notifications
You must be signed in to change notification settings - Fork 877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #611 - Dont break when config file exists but CreationRules are empty #662
Conversation
I think we should do this a different way -- The tests look great by the way! |
@autrilla does it mean you agree with reasoning and tests, but you want to achieve it with bigger refactoring? I am willing to see this through however it's my first golang try so it would be great if you could navigate me a bit :)
What "loading" method would you split into 2? Do you mean Does this only concern creating a new file? Thanks for the feedback! |
No problem at all. I agree with the reasoning, kind of, but I think it has some unintended side effects and is not particularly clear. But yes, I think we should fix this with a bigger refactor.
I was referring to Let me know if you have any questions, I'm more than happy to help you with this. |
Actually there already is a The problem I am fixing here happens during the creation. When I use config only for So I duplicated this behaviour of "assuming config does not exist during creation if configPath is not found" for the case when "config is found but no |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you're right! Thanks for your patch, this is good as it is. We should probably rename LoadConfigForFile to LoadCreationRuleForFile or something along those lines, but let's do that in another PR.
Thanks for the patch :) |
Thanks! Glad we figured it out :) |
This fixes couple of similar issues, one of them a real use-case.
Currently SOPS breaks if .sops.yaml:
creation_rules:
with no defined rulesDestinationRules
but noCreationRules
CreationRules
CreationRules
It should only break in 4th and 5th case. First 3 cases should be treated as if no .sops.yaml was provided. It's best demonstrated by 3rd case when we want to provide KMS/GPG via CLI argument but we want to have
.sops.yaml
file withDestionationRule
to publish secrets to Vault. This is currently not possible and is fixed in this PR.I added tests for all 4 cases. 5th already has a proper test.
Closes #611