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 <rcritten@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Mohammad Rizwan <myusuf@redhat.com>
This commit is contained in:
Rob Crittenden
2020-10-02 15:08:10 -04:00
parent 2ef53196c6
commit e13d058a06

View File

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