From 7c3f6cf2a733b34e11d0e188e5546fe9ec544c50 Mon Sep 17 00:00:00 2001 From: nfraison Date: Tue, 30 Jun 2015 22:14:37 +0200 Subject: [PATCH] Ensure object is type basestring and not only string --- salt/renderers/gpg.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/salt/renderers/gpg.py b/salt/renderers/gpg.py index 3f5ee10c7a..58022daef1 100644 --- a/salt/renderers/gpg.py +++ b/salt/renderers/gpg.py @@ -98,6 +98,7 @@ import salt.ext.six as six # pylint: disable=import-error try: import gnupg + HAS_GPG = True if salt.utils.which('gpg') is None: HAS_GPG = False @@ -122,7 +123,7 @@ def decrypt_ciphertext(cypher, gpg, safe=False): decrypted_data = gpg.decrypt(cypher) if not decrypted_data.ok: decrypt_err = "Could not decrypt cipher {0}, received {1}".format( - cypher, decrypted_data.stderr) + cypher, decrypted_data.stderr) log.error(decrypt_err) if safe: raise SaltRenderError(decrypt_err) @@ -134,11 +135,11 @@ def decrypt_ciphertext(cypher, gpg, safe=False): def decrypt_object(obj, gpg): ''' - Recursively try to decrypt any object. If the object is a string, and + Recursively try to decrypt any object. If the object is a basestring (string or unicode), and it contains a valid GPG header, decrypt it, otherwise keep going until a string is found. ''' - if isinstance(obj, str): + if isinstance(obj, basestring): if GPG_HEADER.search(obj): return decrypt_ciphertext(obj, gpg) else: