summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2014-03-12 11:35:10 +0100
committerPetr Viktorin <pviktori@redhat.com>2014-07-30 16:04:21 +0200
commit2109d6611bafe75f352eb35cfc7b04f2fb113ce3 (patch)
tree9a8ffc41d64c19177bb849eaf4a66fa1a2870f1d
parent9e188574a552e8ece47a181763afa891a4e45bc6 (diff)
downloadfreeipa-2109d6611bafe75f352eb35cfc7b04f2fb113ce3.tar.gz
freeipa-2109d6611bafe75f352eb35cfc7b04f2fb113ce3.tar.xz
freeipa-2109d6611bafe75f352eb35cfc7b04f2fb113ce3.zip
Provide additional functions to ipapython.certmonger.
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
-rw-r--r--ipapython/certmonger.py28
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')