diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2018-02-14 09:00:21 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-14 09:00:21 -0800 |
commit | b90ec246f78ac66c4251996f9bb288875765ccaf (patch) | |
tree | 630a9dd527e7487089810b12419aef3eb1728a16 /roles/lib_openshift | |
parent | 75290a8e32d1658933b59957f8406e2379710ec2 (diff) | |
parent | 8faf061f0656b8816af4efe1015c1a9ed0d34c36 (diff) | |
download | openshift-b90ec246f78ac66c4251996f9bb288875765ccaf.tar.gz openshift-b90ec246f78ac66c4251996f9bb288875765ccaf.tar.bz2 openshift-b90ec246f78ac66c4251996f9bb288875765ccaf.tar.xz openshift-b90ec246f78ac66c4251996f9bb288875765ccaf.zip |
Merge pull request #7135 from abutcher/node-accept-fail
Automatic merge from submit-queue.
oc_adm_csr: allow requesting module failure when timeout reached
Diffstat (limited to 'roles/lib_openshift')
-rw-r--r-- | roles/lib_openshift/library/oc_adm_csr.py | 7 | ||||
-rw-r--r-- | roles/lib_openshift/src/ansible/oc_adm_csr.py | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/roles/lib_openshift/library/oc_adm_csr.py b/roles/lib_openshift/library/oc_adm_csr.py index 3f33d50cd..30e8991cd 100644 --- a/roles/lib_openshift/library/oc_adm_csr.py +++ b/roles/lib_openshift/library/oc_adm_csr.py @@ -1651,6 +1651,7 @@ def main(): timeout=dict(default=30, type='int'), approve_all=dict(default=False, type='bool'), service_account=dict(default='node-bootstrapper', type='str'), + fail_on_timeout=dict(default=False, type='bool'), ), supports_check_mode=True, mutually_exclusive=[['approve_all', 'nodes']], @@ -1661,6 +1662,12 @@ def main(): rval = OCcsr.run_ansible(module.params, module.check_mode) + # If we timed out then we weren't finished. Fail if user requested to fail. + if (module.params['timeout'] > 0 and + module.params['fail_on_timeout'] and + rval['timeout']): + return module.fail_json(msg='Timed out accepting certificate signing requests. Failing as requested.', **rval) + if 'failed' in rval: return module.fail_json(**rval) diff --git a/roles/lib_openshift/src/ansible/oc_adm_csr.py b/roles/lib_openshift/src/ansible/oc_adm_csr.py index 9e43a810b..7b5e245d4 100644 --- a/roles/lib_openshift/src/ansible/oc_adm_csr.py +++ b/roles/lib_openshift/src/ansible/oc_adm_csr.py @@ -16,6 +16,7 @@ def main(): timeout=dict(default=30, type='int'), approve_all=dict(default=False, type='bool'), service_account=dict(default='node-bootstrapper', type='str'), + fail_on_timeout=dict(default=False, type='bool'), ), supports_check_mode=True, mutually_exclusive=[['approve_all', 'nodes']], @@ -26,6 +27,12 @@ def main(): rval = OCcsr.run_ansible(module.params, module.check_mode) + # If we timed out then we weren't finished. Fail if user requested to fail. + if (module.params['timeout'] > 0 and + module.params['fail_on_timeout'] and + rval['timeout']): + return module.fail_json(msg='Timed out accepting certificate signing requests. Failing as requested.', **rval) + if 'failed' in rval: return module.fail_json(**rval) |