diff options
author | Stanislav Laznicka <slaznick@redhat.com> | 2016-06-28 14:37:34 +0200 |
---|---|---|
committer | Martin Basti <mbasti@redhat.com> | 2016-06-30 14:28:14 +0200 |
commit | f3858be6e353fadf0b1da1c31b908264ddd636c5 (patch) | |
tree | a0499b18c372f74326a19635c795bb3dfd78f521 /install | |
parent | 7f4de88ea1da11d4111a917672c0cb7ab9866c90 (diff) | |
download | freeipa-f3858be6e353fadf0b1da1c31b908264ddd636c5.tar.gz freeipa-f3858be6e353fadf0b1da1c31b908264ddd636c5.tar.xz freeipa-f3858be6e353fadf0b1da1c31b908264ddd636c5.zip |
Fix wrong imports in copy-schema-to-ca.py
Some imports were not possible in old versions of IPA. This caused
import exceptions on the script start.
https://fedorahosted.org/freeipa/ticket/6003
Reviewed-By: Petr Spacek <pspacek@redhat.com>
Diffstat (limited to 'install')
-rwxr-xr-x | install/share/copy-schema-to-ca.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/install/share/copy-schema-to-ca.py b/install/share/copy-schema-to-ca.py index c2f070aa2..6cbe3ddec 100755 --- a/install/share/copy-schema-to-ca.py +++ b/install/share/copy-schema-to-ca.py @@ -21,7 +21,17 @@ from ipapython import ipautil from ipapython.ipa_log_manager import root_logger, standard_logging_setup from ipaserver.install.dsinstance import schema_dirname from ipalib import api -from ipaplatform.constants import constants + +try: + # BE CAREFUL when using the constants module - you need to define all + # the constants separately because of old IPA installations + from ipaplatform.constants import constants + PKI_USER = constants.PKI_USER + DS_USER = constants.DS_USER +except ImportError: + # oh dear, this is an old IPA (3.0+) + from ipaserver.install.dsinstance import DS_USER #pylint: disable=E0611 + from ipaserver.install.cainstance import PKI_USER #pylint: disable=E0611 try: from ipaplatform import services @@ -52,8 +62,8 @@ def _sha1_file(filename): def add_ca_schema(): """Copy IPA schema files into the CA DS instance """ - pki_pent = pwd.getpwnam(constants.PKI_USER) - ds_pent = pwd.getpwnam(constants.DS_USER) + pki_pent = pwd.getpwnam(PKI_USER) + ds_pent = pwd.getpwnam(DS_USER) for schema_fname in SCHEMA_FILENAMES: source_fname = os.path.join(ipautil.SHARE_DIR, schema_fname) target_fname = os.path.join(schema_dirname(SERVERID), schema_fname) |