URL: https://github.com/freeipa/freeipa/pull/1636 Author: tiran Title: #1636: Upgrade HTTPd's alias db to SQL Action: opened
PR body: """ https://pagure.io/freeipa/issue/7354 Signed-off-by: Christian Heimes <chei...@redhat.com> """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/1636/head:pr1636 git checkout pr1636
From 0ff98ad91b2d0fc752abb58696b0da6d3f66d19c Mon Sep 17 00:00:00 2001 From: Christian Heimes <chei...@redhat.com> Date: Mon, 26 Feb 2018 18:09:23 +0100 Subject: [PATCH] Upgrade HTTPd's alias db to SQL https://pagure.io/freeipa/issue/7354 Signed-off-by: Christian Heimes <chei...@redhat.com> --- ipaserver/install/certs.py | 16 ---------------- ipaserver/install/server/upgrade.py | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/ipaserver/install/certs.py b/ipaserver/install/certs.py index 50b9716453..9417319c26 100644 --- a/ipaserver/install/certs.py +++ b/ipaserver/install/certs.py @@ -687,22 +687,6 @@ def is_ipa_issued_cert(self, api, nickname): return is_ipa_issued_cert(api, cert) - def needs_upgrade_format(self): - """Check if NSSDB file format needs upgrade - - Only upgrade if it's an existing dbm database and default - database type is no 'dbm'. - """ - return ( - self.nssdb.dbtype == 'dbm' and - self.exists() - ) - - def upgrade_format(self): - """Upgrade NSSDB to new file format - """ - self.nssdb.convert_db() - class _CrossProcessLock(object): _DATETIME_FORMAT = '%Y%m%d%H%M%S%f' diff --git a/ipaserver/install/server/upgrade.py b/ipaserver/install/server/upgrade.py index 57fddc6e29..eafa70ffba 100644 --- a/ipaserver/install/server/upgrade.py +++ b/ipaserver/install/server/upgrade.py @@ -209,6 +209,21 @@ def check_certs(): else: logger.debug('Certificate file exists') + +def convert_httpd_nssdb(): + """Convert HTTPD's NSSDB as early as possible + """ + db = certs.CertDB(api.env.realm, nssdir=paths.HTTPD_ALIAS_DIR) + if db.nssdb.dbtype == 'sql': + logger.debug('%s is already a SQL database', paths.HTTPD_ALIAS_DIR) + return + with installutils.stopped_service('httpd'): + logger.info( + 'Converting NSSDB %s to SQL format', paths.HTTPD_ALIAS_DIR + ) + db.nssdb.convert_db(rename_old=True) + + def update_dbmodules(realm, filename=paths.KRB5_CONF): newfile = [] found_dbrealm = False @@ -1619,6 +1634,9 @@ def upgrade_configuration(): fqdn = api.env.host + # convert NSSDB right away + convert_httpd_nssdb() + # Ok, we are an IPA server, do the additional tests ds_serverid = installutils.realm_to_serverid(api.env.realm) ds = dsinstance.DsInstance()
_______________________________________________ FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org