diff options
Diffstat (limited to 'ipapython/certmonger.py')
-rw-r--r-- | ipapython/certmonger.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/ipapython/certmonger.py b/ipapython/certmonger.py index 0099d239d..673707384 100644 --- a/ipapython/certmonger.py +++ b/ipapython/certmonger.py @@ -27,6 +27,7 @@ import re import time from ipapython import ipautil from ipapython import dogtag +from ipapython.ipa_log_manager import * from ipaplatform.paths import paths REQUEST_DIR=paths.CERTMONGER_REQUESTS_DIR @@ -278,6 +279,20 @@ def stop_tracking(secdir, request_id=None, nickname=None): return (stdout, stderr, returncode) +def modify(request_id, profile=None): + args = [paths.GETCERT, 'start-tracking', + '-i', request_id] + if profile: + args += ['-T', profile] + return ipautil.run(args) + +def resubmit_request(request_id, profile=None): + args = [paths.IPA_GETCERT, 'resubmit', + '-i', request_id] + if profile: + args += ['-T', profile] + return ipautil.run(args) + def _find_IPA_ca(): """ Look through all the certmonger CA files to find the one that @@ -446,6 +461,19 @@ def check_state(dirs): return reqids +def wait_for_request(request_id, timeout=120): + for i in range(0, timeout, 5): + state = get_request_value(request_id, 'state').strip() + root_logger.debug("certmonger request is in state %r", state) + if state in ('CA_REJECTED', 'CA_UNREACHABLE', 'CA_UNCONFIGURED', + 'NEED_GUIDANCE', 'NEED_CA', 'MONITORING'): + break + time.sleep(5) + else: + raise RuntimeError("request timed out") + + return state + if __name__ == '__main__': request_id = request_cert(paths.HTTPD_ALIAS_DIR, "Test", "cn=tiger.example.com,O=IPA", "HTTP/tiger.example.com@EXAMPLE.COM") csr = get_request_value(request_id, 'csr') |