On 01/29/2013 04:39 PM, Petr Viktorin wrote:
On 01/28/2013 04:09 PM, Petr Viktorin wrote:
On 01/28/2013 09:34 AM, Jan Cholasta wrote:
On 25.1.2013 14:54, Petr Viktorin wrote:
On 01/24/2013 03:06 PM, Petr Viktorin wrote:
On 01/24/2013 10:43 AM, Petr Viktorin wrote:
On 01/22/2013 04:04 PM, Petr Viktorin wrote:
On 01/21/2013 06:38 PM, Petr Viktorin wrote:
On 01/17/2013 06:27 PM, Petr Viktorin wrote:
Hello,
This is the first batch of changes aimed to consolidate our LDAP
code.
Each should be a self-contained change that doesn't break
anything.

These patches do some general cleanup (some of the changes might
seem
trivial but help a lot when grepping through the code); merge the
common
parts LDAPEntry, Entry and Entity classes; and move stuff that
depends
on an installed server out of IPASimpleLDAPObject and SchemaCache.

I'm posting them early so you can see where I'm going, and so you
can
find out if your work will conflict with mine.


Here is a third set of patches. These apply on top of jcholast's
patches
94-96.


I found mistakes in two of the patches, attaching fixed versions.



Since this patchset is becoming unwieldy, I've put it in a public repo
that I'll keep updated. The following command will fetch it into your
"pviktori-ldap-refactor" branch:

     git fetch git://github.com/encukou/freeipa
ldap-refactor:pviktori-ldap-refactor



I don't think patch 139 is necessary, I fixed this problem in patch 95
by not including 'dn' as attribute in _entry_to_entity.


You're right. I'm retiring patch 139.
We'll need to use entry.dn everywhere, and add an assert so that
entry['dn'] is never set.


Here is a fourth set of patches.


Honza noticed test failures caused by patch 143. Patch 123 grew a
conflict with master. Fixes attached.


Today, patch 144 had a merge conflict.

--
PetrĀ³
From a12814e6b7cdd22641ef95fe8417d2bde3ae7c07 Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pvikt...@redhat.com>
Date: Mon, 21 Jan 2013 06:05:07 -0500
Subject: [PATCH] Remove unused imports from ipaserver/install

Part of the work for: https://fedorahosted.org/freeipa/ticket/2660
---
 ipaserver/install/adtrustinstance.py               |    9 ++++-----
 ipaserver/install/bindinstance.py                  |   15 ++++++---------
 ipaserver/install/cainstance.py                    |    8 +-------
 ipaserver/install/certs.py                         |   16 +++-------------
 ipaserver/install/httpinstance.py                  |    5 ++---
 ipaserver/install/installutils.py                  |    5 -----
 ipaserver/install/ntpinstance.py                   |    1 -
 ipaserver/install/plugins/baseupdate.py            |    1 -
 ipaserver/install/plugins/dns.py                   |    1 -
 .../install/plugins/fix_replica_agreements.py      |    2 +-
 ipaserver/install/plugins/rename_managed.py        |    5 +----
 ipaserver/install/service.py                       |   14 +++++++-------
 12 files changed, 25 insertions(+), 57 deletions(-)

diff --git a/ipaserver/install/adtrustinstance.py b/ipaserver/install/adtrustinstance.py
index 425d69f08fa01067bb90f0fa30d74c139f9b8564..a2061fd74ea5a8dd055359726dd3f30f3a54098f 100644
--- a/ipaserver/install/adtrustinstance.py
+++ b/ipaserver/install/adtrustinstance.py
@@ -22,7 +22,10 @@ import errno
 import ldap
 import tempfile
 import uuid
-from ipaserver.install import installutils
+import string
+import struct
+import re
+
 from ipaserver.install import service
 from ipaserver.install.dsinstance import realm_to_serverid
 from ipaserver.install.bindinstance import get_rr, add_rr, del_rr, \
@@ -33,13 +36,9 @@ from ipapython import sysrestore
 from ipapython import ipautil
 from ipapython.ipa_log_manager import *
 from ipapython import services as ipaservices
-from ipapython.dn import DN
 
 import ipaclient.ipachangeconf
 
-import string
-import struct
-import re
 
 ALLOWED_NETBIOS_CHARS = string.ascii_uppercase + string.digits
 
diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index a528320c8129f1ccfcb3837867165f4891362aa1..123f559aa0ad4b45353d3c4c98f3e384717829f1 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -23,25 +23,22 @@ import pwd
 import netaddr
 import re
 
-import installutils
 import ldap
+
+import installutils
 import service
 from ipaserver import ipaldap
 from ipaserver.install.dsinstance import realm_to_serverid
 from ipaserver.install.cainstance import IPA_CA_CNAME
-from ipaserver.install.installutils import resolve_host
 from ipapython import sysrestore
 from ipapython import ipautil
-from ipalib.parameters import IA5Str
+from ipapython.ipa_log_manager import *
+from ipapython.dn import DN
+import ipalib
+from ipalib import api, errors
 from ipalib.util import (validate_zonemgr, normalize_zonemgr,
         get_dns_forward_zone_update_policy, get_dns_reverse_zone_update_policy,
         normalize_zone, get_reverse_zone_default, zone_is_reverse)
-from ipapython.ipa_log_manager import *
-from ipalib.text import _
-
-import ipalib
-from ipalib import api, util, errors
-from ipapython.dn import DN
 
 NAMED_CONF = '/etc/named.conf'
 RESOLV_CONF = '/etc/resolv.conf'
diff --git a/ipaserver/install/cainstance.py b/ipaserver/install/cainstance.py
index e26dbaa6c75d484c6907d240fabecac34bac42a8..1c97041a5fbb0acafdb0963faa20d790ec26b6db 100644
--- a/ipaserver/install/cainstance.py
+++ b/ipaserver/install/cainstance.py
@@ -34,33 +34,27 @@ import httplib
 import urllib
 import xml.dom.minidom
 import stat
-import socket
 import syslog
 import ConfigParser
+
 from ipapython import dogtag
 from ipapython.certdb import get_ca_nickname
 from ipapython import certmonger
 from ipalib import pkcs10, x509
 from ipalib import errors
 from ipapython.dn import DN
 import subprocess
 import traceback
 
-from nss.error import NSPRError
-import nss.nss as nss
-
 from ipapython import ipautil
-from ipapython import nsslib
 from ipapython import services as ipaservices
 
 from ipaserver import ipaldap
 from ipaserver.install import service
 from ipaserver.install import installutils
 from ipaserver.install import dsinstance
 from ipaserver.install import certs
-from ipaserver.install.installutils import ReplicaConfig
 from ipaserver.plugins import ldap2
-from ipalib import util
 from ipapython.ipa_log_manager import *
 
 HTTPD_CONFD = "/etc/httpd/conf.d/"
diff --git a/ipaserver/install/certs.py b/ipaserver/install/certs.py
index 7b408586d70432b51c4a8f73944a8f4d66b7001f..11910b53e83551aad66fb9f07363ff0db057fbb2 100644
--- a/ipaserver/install/certs.py
+++ b/ipaserver/install/certs.py
@@ -19,37 +19,27 @@
 
 import os, stat, subprocess, re
 import sys
-import errno
 import tempfile
 import shutil
 from ipapython.ipa_log_manager import *
-import urllib
 import xml.dom.minidom
 import pwd
 import fcntl
 import base64
+from ConfigParser import RawConfigParser, MissingSectionHeaderError
 
-from ipapython import nsslib
 from ipapython import dogtag
 from ipapython import sysrestore
 from ipapython import ipautil
 from ipapython import certmonger
 from ipapython.certdb import get_ca_nickname
-from ipalib import pkcs10
-from ConfigParser import RawConfigParser, MissingSectionHeaderError
 from ipapython import services as ipaservices
-from ipalib import x509
 from ipapython.dn import DN
+from ipapython.compat import sha1
+from ipalib import pkcs10, x509, api
 from ipalib.errors import CertificateOperationError
 from ipalib.text import _
 
-from nss.error import NSPRError
-import nss.nss as nss
-
-from ipalib import api
-
-from ipapython.compat import sha1
-
 # Apache needs access to this database so we need to create it
 # where apache can reach
 NSS_DIR = "/etc/httpd/alias"
diff --git a/ipaserver/install/httpinstance.py b/ipaserver/install/httpinstance.py
index 5c35b5cd2728a56e7c81315392b758f69c1375ae..62ef41e7af5848613e05bfc51852013a99bc2c18 100644
--- a/ipaserver/install/httpinstance.py
+++ b/ipaserver/install/httpinstance.py
@@ -20,19 +20,18 @@
 import os
 import os.path
 import tempfile
-from ipapython.ipa_log_manager import *
 import pwd
 import shutil
 
 import service
 import certs
-import dsinstance
 import installutils
 from ipapython import sysrestore
 from ipapython import ipautil
 from ipapython import services as ipaservices
 from ipapython import dogtag
-from ipalib import util, api
+from ipapython.ipa_log_manager import *
+from ipalib import api
 
 HTTPD_DIR = "/etc/httpd"
 SSL_CONF = HTTPD_DIR + "/conf.d/ssl.conf"
diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py
index 3368533d1537db26cd3ce35c3d6ed111167967e0..a9728582c5229578716cd7e6acde3af870886d84 100644
--- a/ipaserver/install/installutils.py
+++ b/ipaserver/install/installutils.py
@@ -18,16 +18,11 @@
 #
 
 import socket
-import errno
 import getpass
 import os
 import re
 import fileinput
 import sys
-import struct
-import fcntl
-import netaddr
-import time
 import tempfile
 import shutil
 from ConfigParser import SafeConfigParser, NoOptionError
diff --git a/ipaserver/install/ntpinstance.py b/ipaserver/install/ntpinstance.py
index 5fbe21df4dcd442358429ffed048e3d9dc77bf69..f2e8ffe3626b22a4555972ec73b2eb2b2080ab3c 100644
--- a/ipaserver/install/ntpinstance.py
+++ b/ipaserver/install/ntpinstance.py
@@ -21,7 +21,6 @@
 import service
 from ipapython import sysrestore
 from ipapython import ipautil
-from ipapython import services as ipaservices
 from ipapython.ipa_log_manager import *
 
 class NTPInstance(service.Service):
diff --git a/ipaserver/install/plugins/baseupdate.py b/ipaserver/install/plugins/baseupdate.py
index a0e0884784fd0d5f881de8e2203a5474e8ffc4a6..a480a8ee289646374af33f98dcf1f6978a969aa5 100644
--- a/ipaserver/install/plugins/baseupdate.py
+++ b/ipaserver/install/plugins/baseupdate.py
@@ -18,7 +18,6 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from ipalib import api
-from ipalib import errors
 from ipalib import Updater, Object
 from ipaserver.install import service
 from ipaserver.install.plugins import PRE_UPDATE, POST_UPDATE, MIDDLE
diff --git a/ipaserver/install/plugins/dns.py b/ipaserver/install/plugins/dns.py
index d55596704f676a7c7072e4656c1b5cf6537b506a..b875ff019942a37b39593bf0ad30ce3f579d13c3 100644
--- a/ipaserver/install/plugins/dns.py
+++ b/ipaserver/install/plugins/dns.py
@@ -19,7 +19,6 @@
 
 from ipaserver.install.plugins import MIDDLE
 from ipaserver.install.plugins.baseupdate import PostUpdate
-from ipaserver.install.plugins import baseupdate
 from ipalib import api, errors, util
 from ipapython.dn import DN
 from ipalib.plugins.dns import dns_container_exists
diff --git a/ipaserver/install/plugins/fix_replica_agreements.py b/ipaserver/install/plugins/fix_replica_agreements.py
index 54cbdd4d76c4d4e4792e3e904ed078a63bdd4b94..82098dd5abc3ea3f8208830fb82c439f5cac8d4c 100644
--- a/ipaserver/install/plugins/fix_replica_agreements.py
+++ b/ipaserver/install/plugins/fix_replica_agreements.py
@@ -19,7 +19,7 @@
 
 import os
 import pwd
-from ipaserver.install.plugins import PRE_UPDATE, MIDDLE
+from ipaserver.install.plugins import MIDDLE
 from ipaserver.install.plugins.baseupdate import PreUpdate
 from ipaserver import ipaldap
 from ipaserver.install import replication
diff --git a/ipaserver/install/plugins/rename_managed.py b/ipaserver/install/plugins/rename_managed.py
index 99dac81480b73394ad15785063c47a1adbf3bbe9..c83e8a8a2d4c943e7d09d94b019092b55b036ac8 100644
--- a/ipaserver/install/plugins/rename_managed.py
+++ b/ipaserver/install/plugins/rename_managed.py
@@ -17,11 +17,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-from ipaserver.install.plugins import PRE_UPDATE, POST_UPDATE, FIRST, LAST
-from ipaserver.install.plugins import PRE_UPDATE, POST_UPDATE, FIRST, LAST
+from ipaserver.install.plugins import FIRST, LAST
 from ipaserver.install.plugins.baseupdate import PreUpdate, PostUpdate
-from ipalib.frontend import Updater
-from ipaserver.install.plugins import baseupdate
 from ipalib import api, errors
 from ipapython import ipautil
 from ipapython.dn import DN, EditableDN
diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py
index c0406d0ef9d83e93ba096e18f2cda03c77916125..dde36a8295e132d6245038c4f4396175ca08a10f 100644
--- a/ipaserver/install/service.py
+++ b/ipaserver/install/service.py
@@ -21,19 +21,19 @@ import sys
 import os, socket
 import tempfile
 import pwd
+import time
+import datetime
+
+import ldap
+
 from ipapython import sysrestore
 from ipapython import ipautil
 from ipapython import dogtag
 from ipapython import services as ipaservices
-from ipalib import errors
 from ipapython.dn import DN
-import ldap
-from ipaserver import ipaldap
-import base64
-import time
-import datetime
-from ipaserver.install import installutils
 from ipapython.ipa_log_manager import *
+from ipalib import errors
+from ipaserver import ipaldap
 
 CACERT = "/etc/ipa/ca.crt"
 
-- 
1.7.7.6

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to