summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2024-01-22 15:05:02 +0100
committerAndreas Schneider <asn@cryptomilk.org>2024-01-29 09:32:46 +0000
commit98dc44286ea102ef7701ccdea26bbde32b523a7e (patch)
tree9a03463e29943e6a80d53fd0bbf1436dd363ca17 /python
parent728757cd1ff0465967fcbda100254c9312e87c93 (diff)
downloadsamba-98dc44286ea102ef7701ccdea26bbde32b523a7e.tar.gz
samba-98dc44286ea102ef7701ccdea26bbde32b523a7e.tar.bz2
samba-98dc44286ea102ef7701ccdea26bbde32b523a7e.zip
python:gp: Do not print an error if template already exists
We will get an exit status for duplicate in future: https://www.pagure.io/certmonger/issue/269 We can't really fix that right now, as older version of certmonger don't support the `-v` option. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15559 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: David Mulder <dmulder@samba.org> Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/samba/gp/gp_cert_auto_enroll_ext.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/python/samba/gp/gp_cert_auto_enroll_ext.py b/python/samba/gp/gp_cert_auto_enroll_ext.py
index 1547e9db983..b55a0ce3bd0 100644
--- a/python/samba/gp/gp_cert_auto_enroll_ext.py
+++ b/python/samba/gp/gp_cert_auto_enroll_ext.py
@@ -338,8 +338,12 @@ def cert_enroll(ca, ldb, trust_dir, private_dir, auth='Kerberos'):
out, err = p.communicate()
log.debug(out.decode())
if p.returncode != 0:
- data = { 'Error': err.decode(), 'Certificate': nickname }
- log.error('Failed to request certificate', data)
+ if p.returncode == 2:
+ log.info('The template [%s] already exists' % (nickname))
+ else:
+ data = {'Error': err.decode(), 'Certificate': nickname}
+ log.error('Failed to request certificate', data)
+
data['files'].extend([keyfile, certfile])
data['templates'].append(nickname)
if update is not None: