fixed gpg.decrypt function#62977
Conversation
|
I'll rework the |
|
Hi @leifliddy, it seems like there was some discussion on the fix in #62896. If this PR depends on that one, I will ask to get more eyes on the other one to see how we want to handle it. |
|
@MKLeb Cool, thanks! It seems to be a bit of a divisive topic. If Gareth wants to "follow our normal deprecation path" I'd just like some clarification on what that means. There's no salt documentation that lists |
|
@leifliddy The GPG version check PR has been merged... were you planning on adding the encryption changes to this PR or a separate one? |
|
I can do it on this one. I just need a day or so to rebase the current changes and to add the encryption changes. |
11be4c1 to
8915064
Compare
1. don't query pillar for passphrase when we're not signing a message 2. allow a text message to be encrypted, signed and written to disk 3. removed gpg_passphrase dict line
|
I realize that this PR is all over the place. It's technically resolving an issue with the decrypt and encrypt functions. But, it also introduces the new argument I couldn't for the life of me develop a unit test that ran through the I just didn't know how to mock that -- in any case it's probably better testing-wise to isolate functions as much as possible (in the unit tests) to avoid the need for dependent functions. On another note, I don't see why we can't just use the That would provide the added functionality of being able to process multiple keys at once while not relying on Anyways, let me know what you think... |
If output=None, then key will be outputted to stdout
|
I see that four people had already approved this...and so I really hate to do this, but I needed to make one last change. if output:
result = gpg.encrypt_file(
_fp,
recipients,
passphrase=gpg_passphrase,
sign=sign,
always_trust=always_trust,
)There's no need to do a conditional check on elif filename:
with salt.utils.files.flopen(filename, "rb") as _fp:
result = gpg.encrypt_file(
_fp,
recipients,
sign=sign,
passphrase=gpg_passphrase,
always_trust=always_trust,
output=output,
) |
|
No worries. We will wait to re-review after you push your changes |
|
Thanks. The change has already been pushed. |
|
Oh I see, The commit was before your comment. Thanks, i'll review right now |
What does this PR do?
gpg.decryptnow works whenuse_passphrase=TrueWhat issues does this PR fix or reference?
Fixes: #62806
Previous Behavior
gpg.decryptdid not function correctly whenuse_passphrase=Truewas passedNew Behavior
gpg.decryptnow functions correctly whenuse_passphrase=Truewas passedMerge requirements satisfied?
Commits signed with GPG?
Yes