FAQ | This is a LIVE service | Changelog

Commit 0e2362f5 authored by Tony Finch's avatar Tony Finch

ansible: subprocess can raise OSError

So catch both kinds of exception and retry. The OSError case
is only important for the gpg1 -> gpg retry, but it isn't a
problem for the gpg -> gpg attempt to recover from random
failures.
parent c2b31ce1
......@@ -95,14 +95,15 @@ class ActionModule(ActionBase):
[gpg, '--use-agent', '--batch', '--quiet', '--decrypt', src],
stderr=stderr)
break
except subprocess.CalledProcessError as e:
gpg = 'gpg'
stderr = None
tries -= 1
if tries > 0:
continue
except Exception as e:
if isinstance(e, (OSError, subprocess.CalledProcessError)):
gpg = 'gpg'
stderr = None
tries -= 1
if tries > 0:
continue
result['failed'] = True
result['msg'] = 'gpg --decrypt '+src+' failed: '+e.output
result['msg'] = 'gpg --decrypt '+src+' failed: '+e
return result
if cleartext == "":
......
......@@ -27,14 +27,15 @@ def gpg_d(file):
[gpg, '--use-agent', '--batch', '--quiet', '--decrypt', file],
stderr=stderr)
break
except subprocess.CalledProcessError as e:
gpg = 'gpg'
stderr = None
tries -= 1
if tries > 0:
continue
except Exception as e:
if isinstance(e, (OSError, subprocess.CalledProcessError)):
gpg = 'gpg'
stderr = None
tries -= 1
if tries > 0:
continue
raise ansible.errors.AnsibleFilterError(
'gpg --decrypt '+file+' failed: '+e.output)
'gpg --decrypt '+file+' failed: '+e)
if output == "":
raise ansible.errors.AnsibleFilterError(
'gpg --decrypt '+file+' produced no output')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment