diff options
author | Luke Meyer <sosiouxme@gmail.com> | 2017-09-14 22:44:15 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-14 22:44:15 -0400 |
commit | 51837924d85f27ccdf83db808746d1a2688685ba (patch) | |
tree | c624d0626281ed129ff50be09414eeba21003e47 /roles/lib_utils/src | |
parent | 7bcded20fab1e3dc9f3fabcd7850461fcb66fb39 (diff) | |
parent | c4b7a45842843290d81e0cb29081d01f2210bfee (diff) | |
download | openshift-51837924d85f27ccdf83db808746d1a2688685ba.tar.gz openshift-51837924d85f27ccdf83db808746d1a2688685ba.tar.bz2 openshift-51837924d85f27ccdf83db808746d1a2688685ba.tar.xz openshift-51837924d85f27ccdf83db808746d1a2688685ba.zip |
Merge pull request #5401 from sosiouxme/20170913-retries-subset
add retries on repoquery
Diffstat (limited to 'roles/lib_utils/src')
-rw-r--r-- | roles/lib_utils/src/ansible/repoquery.py | 17 | ||||
-rw-r--r-- | roles/lib_utils/src/lib/import.py | 1 |
2 files changed, 12 insertions, 6 deletions
diff --git a/roles/lib_utils/src/ansible/repoquery.py b/roles/lib_utils/src/ansible/repoquery.py index 40773b1c1..5f5b93639 100644 --- a/roles/lib_utils/src/ansible/repoquery.py +++ b/roles/lib_utils/src/ansible/repoquery.py @@ -19,17 +19,22 @@ def main(): show_duplicates=dict(default=False, required=False, type='bool'), match_version=dict(default=None, required=False, type='str'), ignore_excluders=dict(default=False, required=False, type='bool'), + retries=dict(default=4, required=False, type='int'), + retry_interval=dict(default=5, required=False, type='int'), ), supports_check_mode=False, required_if=[('show_duplicates', True, ['name'])], ) - rval = Repoquery.run_ansible(module.params, module.check_mode) - - if 'failed' in rval: - module.fail_json(**rval) - - module.exit_json(**rval) + tries = 1 + while True: + rval = Repoquery.run_ansible(module.params, module.check_mode) + if 'failed' not in rval: + module.exit_json(**rval) + elif tries > module.params['retries']: + module.fail_json(**rval) + tries += 1 + time.sleep(module.params['retry_interval']) if __name__ == "__main__": diff --git a/roles/lib_utils/src/lib/import.py b/roles/lib_utils/src/lib/import.py index 567f8c9e0..07a04b7ae 100644 --- a/roles/lib_utils/src/lib/import.py +++ b/roles/lib_utils/src/lib/import.py @@ -10,6 +10,7 @@ import os # noqa: F401 import re # noqa: F401 import shutil # noqa: F401 import tempfile # noqa: F401 +import time # noqa: F401 try: import ruamel.yaml as yaml # noqa: F401 |