From e13d058a066bdbd8a81b794b6f18ca8eca1f31c8 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Nov 02 2020 15:43:57 +0000 Subject: Let dogtag.py be imported if the api is not initialized This allows non-plugin components to import the RestClient classes. Removed code that only imported pki if in_server was True. This was legacy code from when the plugins were also loaded in the client. Left the ra_plugin stanza for now. This is part of the old abstraction that allowed for different CA plugins. https://pagure.io/freeipa/issue/8524 Signed-off-by: Rob Crittenden Reviewed-By: Fraser Tweedale Reviewed-By: Christian Heimes Reviewed-By: Alexander Bokovoy Reviewed-By: Rob Crittenden Reviewed-By: Mohammad Rizwan --- diff --git a/ipaserver/plugins/dogtag.py b/ipaserver/plugins/dogtag.py index 594f32f..d56f82a 100644 --- a/ipaserver/plugins/dogtag.py +++ b/ipaserver/plugins/dogtag.py @@ -256,11 +256,10 @@ import ipapython.cookie from ipapython import dogtag, ipautil, certdb from ipaserver.masters import find_providing_server -if api.env.in_server: - import pki - from pki.client import PKIConnection - import pki.crypto as cryptoutil - from pki.kra import KRAClient +import pki +from pki.client import PKIConnection +import pki.crypto as cryptoutil +from pki.kra import KRAClient if six.PY3: unicode = str @@ -1101,7 +1100,7 @@ def parse_updateCRL_xml(doc): #------------------------------------------------------------------------------- from ipalib import Registry, errors, SkipPluginModule -if api.env.ra_plugin != 'dogtag': +if api.isdone('finalize') and api.env.ra_plugin != 'dogtag': # In this case, abort loading this plugin module... raise SkipPluginModule(reason='dogtag not selected as RA plugin') import os