mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Merge pull request #29047 from schwing/fix-gpg-exception
Fix salt.modules.gpg.import_key exception: 'GPG_1_3_1 referenced before assignment'
This commit is contained in:
commit
b692ab1cfb
@ -651,11 +651,6 @@ def import_key(user=None,
|
||||
|
||||
imported_data = gpg.import_keys(text)
|
||||
|
||||
# include another check for Salt unit tests
|
||||
gnupg_version = distutils.version.LooseVersion(gnupg.__version__)
|
||||
if gnupg_version >= '1.3.1':
|
||||
GPG_1_3_1 = True
|
||||
|
||||
if GPG_1_3_1:
|
||||
counts = imported_data.counts
|
||||
if counts.get('imported') or counts.get('imported_rsa'):
|
||||
|
@ -336,6 +336,10 @@ class GpgTestCase(TestCase):
|
||||
self.assertRaises(SaltInvocationError, gpg.import_key,
|
||||
filename='/path/to/public-key-file')
|
||||
|
||||
gpg.GPG_1_3_1 = True
|
||||
self.assertDictEqual(gpg.import_key(text='-BEGIN PGP PUBLIC KEY BLOCK-'), ret)
|
||||
|
||||
gpg.GPG_1_3_1 = False
|
||||
self.assertDictEqual(gpg.import_key(text='-BEGIN PGP PUBLIC KEY BLOCK-'), ret)
|
||||
|
||||
# 'export_key' function tests: 1
|
||||
|
Loading…
Reference in New Issue
Block a user