mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
fixed formatting errors
This commit is contained in:
parent
ccb323fcc5
commit
543e5c3280
2 changed files with 23 additions and 11 deletions
|
@ -1224,7 +1224,14 @@ def encrypt(
|
|||
gpg_passphrase = None
|
||||
|
||||
if text:
|
||||
result = gpg.encrypt(text, recipients, passphrase=gpg_passphrase, sign=sign, output=output, always_trust=always_trust)
|
||||
result = gpg.encrypt(
|
||||
text,
|
||||
recipients,
|
||||
passphrase=gpg_passphrase,
|
||||
sign=sign,
|
||||
output=output,
|
||||
always_trust=always_trust,
|
||||
)
|
||||
elif filename:
|
||||
with salt.utils.files.flopen(filename, "rb") as _fp:
|
||||
if output:
|
||||
|
@ -1232,12 +1239,17 @@ def encrypt(
|
|||
_fp,
|
||||
recipients,
|
||||
passphrase=gpg_passphrase,
|
||||
output=output,
|
||||
sign=sign,
|
||||
always_trust=always_trust,
|
||||
output=output,
|
||||
)
|
||||
else:
|
||||
result = gpg.encrypt_file(
|
||||
_fp, recipients, passphrase=gpg_passphrase, sign=sign, always_trust=always_trust
|
||||
_fp,
|
||||
recipients,
|
||||
passphrase=gpg_passphrase,
|
||||
sign=sign,
|
||||
always_trust=always_trust,
|
||||
)
|
||||
else:
|
||||
raise SaltInvocationError("filename or text must be passed.")
|
||||
|
|
|
@ -865,8 +865,8 @@ def test_gpg_sign(gpghome):
|
|||
with patch.dict(gpg.__salt__, {"config.option": config_user}):
|
||||
with patch.dict(gpg.__salt__, {"user.info": user_info}):
|
||||
with patch.dict(gpg.__salt__, {"pillar.get": pillar_mock}):
|
||||
import_ret = gpg.import_key(None, str(gpghome.priv), "salt", str(gpghome.path))
|
||||
assert import_ret["res"] is True
|
||||
key = gpg.import_key(None, str(gpghome.priv), "salt", str(gpghome.path))
|
||||
assert key["res"] is True
|
||||
gpg_text_input = "The quick brown fox jumped over the lazy dog"
|
||||
ret = gpg.sign(
|
||||
keyid=GPG_TEST_KEY_ID,
|
||||
|
@ -885,8 +885,8 @@ def test_gpg_encrypt_message(gpghome):
|
|||
)
|
||||
with patch.dict(gpg.__salt__, {"config.option": config_user}):
|
||||
with patch.dict(gpg.__salt__, {"user.info": user_info}):
|
||||
import_ret = gpg.import_key(None, str(gpghome.priv), "salt", str(gpghome.path))
|
||||
assert import_ret["res"] is True
|
||||
key = gpg.import_key(None, str(gpghome.priv), "salt", str(gpghome.path))
|
||||
assert key["res"] is True
|
||||
gpg_text_input = "The quick brown fox jumped over the lazy dog"
|
||||
ret = gpg.encrypt(
|
||||
recipients=GPG_TEST_KEY_ID,
|
||||
|
@ -908,8 +908,8 @@ def test_gpg_encrypt_and_sign_message_with_gpg_passphrase_in_pillar(gpghome):
|
|||
with patch.dict(gpg.__salt__, {"config.option": config_user}):
|
||||
with patch.dict(gpg.__salt__, {"user.info": user_info}):
|
||||
with patch.dict(gpg.__salt__, {"pillar.get": pillar_mock}):
|
||||
import_ret = gpg.import_key(None, str(gpghome.priv), "salt", str(gpghome.path))
|
||||
assert import_ret["res"] is True
|
||||
key = gpg.import_key(None, str(gpghome.priv), "salt", str(gpghome.path))
|
||||
assert key["res"] is True
|
||||
gpg_text_input = "The quick brown fox jumped over the lazy dog"
|
||||
ret = gpg.encrypt(
|
||||
recipients=GPG_TEST_KEY_ID,
|
||||
|
@ -950,8 +950,8 @@ def test_gpg_decrypt_message_with_gpg_passphrase_in_pillar(gpghome):
|
|||
with patch.dict(gpg.__salt__, {"config.option": config_user}):
|
||||
with patch.dict(gpg.__salt__, {"user.info": user_info}):
|
||||
with patch.dict(gpg.__salt__, {"pillar.get": pillar_mock}):
|
||||
import_ret = gpg.import_key(None, str(gpghome.priv), "salt", str(gpghome.path))
|
||||
assert import_ret["res"] is True
|
||||
key = gpg.import_key(None, str(gpghome.priv), "salt", str(gpghome.path))
|
||||
assert key["res"] is True
|
||||
ret = gpg.decrypt(
|
||||
text=gpg_encrypted_message,
|
||||
use_passphrase=True,
|
||||
|
|
Loading…
Add table
Reference in a new issue