1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

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>
This commit is contained in:
Andreas Schneider 2024-01-22 15:05:02 +01:00 committed by Andreas Schneider
parent 728757cd1f
commit 98dc44286e

View File

@ -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: