diff options
author | Rob Crittenden <rcritten@redhat.com> | 2008-09-10 02:50:26 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2008-09-12 20:06:46 -0400 |
commit | ec57bc3e44ec5e8f6c7e5e1ad5c56751016e3b09 (patch) | |
tree | 670d02265bdb0b7303fa0bbc184b20669ddc0091 /ipa-python | |
parent | d33b7fc839b4eb87bba06f49d16e5d93b0a87caf (diff) | |
download | freeipa-ec57bc3e44ec5e8f6c7e5e1ad5c56751016e3b09.tar.gz freeipa-ec57bc3e44ec5e8f6c7e5e1ad5c56751016e3b09.tar.xz freeipa-ec57bc3e44ec5e8f6c7e5e1ad5c56751016e3b09.zip |
Tool for doing configuration updates over LDAP
This tool takes as input a file which contains basically an LDIF, prefixed
with a command: default, add, remove or only. These define the operations
to perform such as adding new entries, adding new sub-entries to an existing
entry, adding or modifying attributes in a record.
If an index entry is modified a task is created to re-create the index.
Schema may be added using this tool.
454031
Diffstat (limited to 'ipa-python')
-rw-r--r-- | ipa-python/entity.py | 10 | ||||
-rw-r--r-- | ipa-python/ipautil.py | 10 |
2 files changed, 19 insertions, 1 deletions
diff --git a/ipa-python/entity.py b/ipa-python/entity.py index a5aa33ca3..64db350ba 100644 --- a/ipa-python/entity.py +++ b/ipa-python/entity.py @@ -19,6 +19,7 @@ import ldap import ldif import re import cStringIO +import copy import ipa.ipautil @@ -33,6 +34,13 @@ def utf8_encode_values(values): else: return utf8_encode_value(values) +def copy_CIDict(x): + """Do a deep copy of a CIDict""" + y = {} + for key, value in x.iteritems(): + y[copy.deepcopy(key)] = copy.deepcopy(value) + return y + class Entity: """This class represents an IPA user. An LDAP entry consists of a DN and a list of attributes. Each attribute consists of a name and a list of @@ -63,7 +71,7 @@ class Entity: self.dn = '' self.data = ipa.ipautil.CIDict() - self.orig_data = ipa.ipautil.CIDict(self.data) + self.orig_data = ipa.ipautil.CIDict(copy_CIDict(self.data)) def __nonzero__(self): """This allows us to do tests like if entry: returns false if there is no data, diff --git a/ipa-python/ipautil.py b/ipa-python/ipautil.py index 649a3f203..780fef3d0 100644 --- a/ipa-python/ipautil.py +++ b/ipa-python/ipautil.py @@ -36,6 +36,7 @@ from types import * import re import xmlrpclib import datetime +from ipa import config try: from subprocess import CalledProcessError class CalledProcessError(subprocess.CalledProcessError): @@ -53,6 +54,15 @@ except ImportError: def __str__(self): return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode) +def get_domain_name(): + try: + config.init_config() + domain_name = config.config.get_domain() + except Exception, e: + return None + + return domain_name + def realm_to_suffix(realm_name): s = realm_name.split(".") terms = ["dc=" + x.lower() for x in s] |