acme: handle alternative schema ldif location

pki-server-10.9.0-0.3 relocates the ACME schema LDIF file.  Look for
the file in both the old and new locations to smooth the transition.

Part of: https://pagure.io/freeipa/issue/4751

Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
Fraser Tweedale 2020-06-23 10:04:12 +10:00 committed by Rob Crittenden
parent 85d0272053
commit f9f3b3b118

View File

@ -1107,10 +1107,21 @@ def ca_upgrade_schema(ca):
logger.info('CA is not configured') logger.info('CA is not configured')
return False return False
# ACME schema file moved in pki-server-10.9.0-0.3
for path in [
'/usr/share/pki/acme/conf/database/ldap/schema.ldif',
'/usr/share/pki/acme/database/ldap/schema.ldif',
]:
if os.path.exists(path):
acme_schema_ldif = path
break
else:
raise RuntimeError('ACME schema file not found')
schema_files=[ schema_files=[
'/usr/share/pki/server/conf/schema-certProfile.ldif', '/usr/share/pki/server/conf/schema-certProfile.ldif',
'/usr/share/pki/server/conf/schema-authority.ldif', '/usr/share/pki/server/conf/schema-authority.ldif',
'/usr/share/pki/acme/conf/database/ldap/schema.ldif', acme_schema_ldif,
] ]
try: try:
modified = schemaupdate.update_schema(schema_files, ldapi=True) modified = schemaupdate.update_schema(schema_files, ldapi=True)