[Freeipa-devel] [PATCH] Remove the use of uuid in the directory server instance name

Karl MacMillan kmacmill at redhat.com
Fri Oct 19 18:21:41 UTC 2007


# HG changeset patch
# User "Karl MacMillan <kmacmill at redhat.com>"
# Date 1192818011 14400
# Node ID 82d6225b95a95f399f93141d559beaa9e9b6ab4d
# Parent  61c76c977b20c469a627603b2b90ddafee8342a2
Remove the use of uuid in the directory server instance name.

The use of a uuid for the DS instance name is overkill and it is a real
pain. This patch will use ipa-realm-name instead (resulting in something
like slapd-EXAMPLE-COM). All periods are converted to "-" because the DS
can't handle periods in server ids.

diff -r 61c76c977b20 -r 82d6225b95a9 ipa-server/ipaserver/dsinstance.py
--- a/ipa-server/ipaserver/dsinstance.py	Fri Oct 19 09:18:51 2007 -0700
+++ b/ipa-server/ipaserver/dsinstance.py	Fri Oct 19 14:20:11 2007 -0400
@@ -34,18 +34,6 @@ def ldap_mod(fd, dn, pwd):
 def ldap_mod(fd, dn, pwd):
     args = ["/usr/bin/ldapmodify", "-h", "127.0.0.1", "-xv", "-D", dn, "-w", pwd, "-f", fd.name]
     run(args)
-
-def generate_serverid():
-    """Generate a UUID (universally unique identifier) suitable
-    for use as a unique identifier for a DS instance.
-    """
-    try:
-        import uuid
-        id = str(uuid.uuid1())
-    except ImportError:
-        import commands
-        id = commands.getoutput("/usr/bin/uuidgen")
-    return id
 
 def realm_to_suffix(realm_name):
     s = realm_name.split(".")
@@ -82,8 +70,8 @@ class DsInstance:
 
     def create_instance(self, ds_user, realm_name, host_name, dm_password):
         self.ds_user = ds_user
-        self.serverid = generate_serverid()
         self.realm_name = realm_name.upper()
+        self.serverid = "-".join(self.realm_name.split("."))
         self.suffix = realm_to_suffix(self.realm_name)
         self.host_name = host_name
         self.dm_password = dm_password




More information about the Freeipa-devel mailing list