Merge pull request #8155 from malinoff/fix-gpgkey-fail

Fix apt-key silently fails
This commit is contained in:
Mike Place 2013-10-29 08:31:19 -07:00
commit 6cf66d8d0c
2 changed files with 7 additions and 12 deletions

View File

@ -1139,18 +1139,12 @@ def mod_repo(repo, **kwargs):
if not imported:
cmd = ('apt-key adv --keyserver {0} --logger-fd 1 '
'--recv-keys {1}')
out = __salt__['cmd.run_stdout'](cmd.format(ks, keyid),
**kwargs)
if not (out.find('imported') or out.find('not changed')):
ret= __salt__['cmd.run_all'](cmd.format(ks, keyid),
**kwargs)
if ret['retcode'] != 0:
error_str = 'Error: key retrieval failed: {0}'
raise Exception(
error_str.format(
cmd.format(
ks,
keyid
)
)
)
raise Exception(error_str.format(ret['stdout']))
elif 'key_url' in kwargs:
key_url = kwargs['key_url']
fn_ = __salt__['cp.cache_file'](key_url)

View File

@ -718,7 +718,8 @@ def retcode(cmd,
umask=None,
quiet=False,
timeout=None,
reset_system_locale=True):
reset_system_locale=True,
**kwargs):
'''
Execute a shell command and return the command's return code.