mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Provide additional functions to ipapython.certmonger.
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
parent
9e188574a5
commit
2109d6611b
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user