diff options
| author | Alexander Bokovoy <abokovoy@redhat.com> | 2016-08-05 13:04:19 +0300 |
|---|---|---|
| committer | Martin Basti <mbasti@redhat.com> | 2016-08-19 15:34:26 +0200 |
| commit | 7bec8a246d6712f749ec331f5bf066e3357c4ce7 (patch) | |
| tree | cbb73e447ed63c87c47112e6594b141bf2f74ac1 /ipaserver/install/dsinstance.py | |
| parent | 86e156c3c5f331e3f169b941be2d9f72e7c8f000 (diff) | |
support schema files from third-party plugins
Allow upgrade process to include schema files from third-party plugins
installed in /usr/share/ipa/schema.d/*.schema.
The directory /usr/shar/eipa/schema.d is owned by the server-common
subpackage and therefore third-party plugins should depend on
freeipa-server-common (ipa-server-common) package in their package
dependencies.
Resolves: https://fedorahosted.org/freeipa/ticket/5864
Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'ipaserver/install/dsinstance.py')
| -rw-r--r-- | ipaserver/install/dsinstance.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py index f29737fc1..26cd2461a 100644 --- a/ipaserver/install/dsinstance.py +++ b/ipaserver/install/dsinstance.py @@ -27,6 +27,7 @@ import re import time import tempfile import stat +import fnmatch import ldap @@ -180,6 +181,16 @@ def get_domain_level(api=api): return int(entry.single_value['ipaDomainLevel']) +def get_all_external_schema_files(root): + """Get all schema files""" + f = [] + for path, subdirs, files in os.walk(root): + for name in files: + if fnmatch.fnmatch(name, "*.ldif"): + f.append(os.path.join(path, name)) + return f + + INF_TEMPLATE = """ [General] FullMachineName= $FQDN @@ -656,7 +667,9 @@ class DsInstance(service.Service): conn.unbind() def apply_updates(self): - data_upgrade = upgradeinstance.IPAUpgrade(self.realm) + schema_files = get_all_external_schema_files(paths.EXTERNAL_SCHEMA_DIR) + data_upgrade = upgradeinstance.IPAUpgrade(self.realm, + schema_files=schema_files) try: data_upgrade.create_instance() except Exception as e: |
