summaryrefslogtreecommitdiffstats
path: root/ipaserver
diff options
context:
space:
mode:
Diffstat (limited to 'ipaserver')
-rw-r--r--ipaserver/install/krbinstance.py4
-rw-r--r--ipaserver/install/ldapupdate.py14
-rw-r--r--ipaserver/install/replication.py10
-rw-r--r--ipaserver/ipaldap.py28
-rw-r--r--ipaserver/plugins/ldap2.py50
-rw-r--r--ipaserver/plugins/ldapapi.py10
-rw-r--r--ipaserver/plugins/ra.py2
-rw-r--r--ipaserver/rpcserver.py2
-rw-r--r--ipaserver/servercore.py32
9 files changed, 76 insertions, 76 deletions
diff --git a/ipaserver/install/krbinstance.py b/ipaserver/install/krbinstance.py
index 50df2968..6a45d345 100644
--- a/ipaserver/install/krbinstance.py
+++ b/ipaserver/install/krbinstance.py
@@ -35,7 +35,7 @@ import installutils
from ipapython import sysrestore
from ipapython import ipautil
from ipalib import util
-from ipalib import errors2
+from ipalib import errors
from ipaserver import ipaldap
@@ -322,7 +322,7 @@ class KrbInstance(service.Service):
def __write_stash_from_ds(self):
try:
entry = self.conn.getEntry("cn=%s, cn=kerberos, %s" % (self.realm, self.suffix), ldap.SCOPE_SUBTREE)
- except errors2.NotFound:
+ except errors.NotFound:
logging.critical("Could not find master key in DS")
raise e
diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py
index 17b519b3..ce12607e 100644
--- a/ipaserver/install/ldapupdate.py
+++ b/ipaserver/install/ldapupdate.py
@@ -29,7 +29,7 @@ from ipaserver.install import installutils
from ipaserver import ipaldap
from ipapython import entity, ipautil
from ipalib import util
-from ipalib import errors2
+from ipalib import errors
import ldap
import logging
import krbV
@@ -310,10 +310,10 @@ class LDAPUpdate:
while True:
try:
entry = self.conn.getEntry(dn, ldap.SCOPE_BASE, "(objectclass=*)", attrlist)
- except errors2.NotFound, e:
+ except errors.NotFound, e:
logging.error("Task not found: %s", dn)
return
- except errors2.DatabaseError, e:
+ except errors.DatabaseError, e:
logging.error("Task lookup failure %s", e)
return
@@ -480,11 +480,11 @@ class LDAPUpdate:
entry = self.__entry_to_entity(e[0])
found = True
logging.info("Updating existing entry: %s", entry.dn)
- except errors2.NotFound:
+ except errors.NotFound:
# Doesn't exist, start with the default entry
entry = new_entry
logging.info("New entry: %s", entry.dn)
- except errors2.DatabaseError:
+ except errors.DatabaseError:
# Doesn't exist, start with the default entry
entry = new_entry
logging.info("New entry, using default value: %s", entry.dn)
@@ -521,10 +521,10 @@ class LDAPUpdate:
if self.live_run and updated:
self.conn.updateEntry(entry.dn, entry.origDataDict(), entry.toDict())
logging.info("Done")
- except errors2.EmptyModlist:
+ except errors.EmptyModlist:
logging.info("Entry already up-to-date")
updated = False
- except errors2.DatabaseError, e:
+ except errors.DatabaseError, e:
logging.error("Update failed: %s", e)
updated = False
diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py
index 12db0eb0..653ec3c4 100644
--- a/ipaserver/install/replication.py
+++ b/ipaserver/install/replication.py
@@ -24,7 +24,7 @@ from ipaserver.install import dsinstance
from ipaserver import ipaldap
from ldap import modlist
from ipalib import util
-from ipalib import errors2
+from ipalib import errors
DIRMAN_CN = "cn=directory manager"
CACERT="/usr/share/ipa/html/ca.crt"
@@ -148,7 +148,7 @@ class ReplicationManager:
conn.getEntry(dn, ldap.SCOPE_BASE)
# replication is already configured
return
- except errors2.NotFound:
+ except errors.NotFound:
pass
replica_type = self.get_replica_type()
@@ -220,7 +220,7 @@ class ReplicationManager:
try:
entry = self.conn.getEntry("cn=mapping tree,cn=config", ldap.SCOPE_ONELEVEL,
"(cn=\"%s\")" % (self.suffix))
- except errors2.NotFound, e:
+ except errors.NotFound, e:
logging.debug("failed to find mappting tree entry for %s" % self.suffix)
raise e
@@ -256,7 +256,7 @@ class ReplicationManager:
conn.getEntry(pass_dn, ldap.SCOPE_BASE)
print "Windows PassSync entry exists, not resetting password"
return
- except errors2.NotFound:
+ except errors.NotFound:
pass
# The user doesn't exist, add it
@@ -315,7 +315,7 @@ class ReplicationManager:
try:
a.getEntry(dn, ldap.SCOPE_BASE)
return
- except errors2.NotFound:
+ except errors.NotFound:
pass
iswinsync = kargs.get("winsync", False)
diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py
index e63fe55b..7d194aa9 100644
--- a/ipaserver/ipaldap.py
+++ b/ipaserver/ipaldap.py
@@ -32,7 +32,7 @@ import ldap.sasl
from ldap.controls import LDAPControl,DecodeControlTuples,EncodeControlTuples
from ldap.ldapobject import SimpleLDAPObject
from ipaserver import ipautil
-from ipalib import errors2
+from ipalib import errors
# Global variable to define SASL auth
sasl_auth = ldap.sasl.sasl({},'GSSAPI')
@@ -283,30 +283,30 @@ class IPAdmin(SimpleLDAPObject):
raise e
except ldap.NO_SUCH_OBJECT, e:
args = kw.get('args', '')
- raise errors2.NotFound(msg=notfound(args))
+ raise errors.NotFound(msg=notfound(args))
except ldap.ALREADY_EXISTS, e:
- raise errors2.DuplicateEntry()
+ raise errors.DuplicateEntry()
except ldap.CONSTRAINT_VIOLATION, e:
# This error gets thrown by the uniqueness plugin
if info == 'Another entry with the same attribute value already exists':
- raise errors2.DuplicateEntry()
+ raise errors.DuplicateEntry()
else:
- raise errors2.DatabaseError(desc=desc,info=info)
+ raise errors.DatabaseError(desc=desc,info=info)
except ldap.INSUFFICIENT_ACCESS, e:
- raise errors2.ACIError(info=info)
+ raise errors.ACIError(info=info)
except ldap.NO_SUCH_ATTRIBUTE:
# this is raised when a 'delete' attribute isn't found.
# it indicates the previous attribute was removed by another
# update, making the oldentry stale.
- raise errors2.MidairCollision()
+ raise errors.MidairCollision()
except ldap.ADMINLIMIT_EXCEEDED, e:
- raise errors2.LimitsExceeded()
+ raise errors.LimitsExceeded()
except ldap.SIZELIMIT_EXCEEDED, e:
- raise errors2.LimitsExceeded()
+ raise errors.LimitsExceeded()
except ldap.TIMELIMIT_EXCEEDED, e:
- raise errors2.LimitsExceeded()
+ raise errors.LimitsExceeded()
except ldap.LDAPError, e:
- raise errors2.DatabaseError(desc=desc,info=info)
+ raise errors.DatabaseError(desc=desc,info=info)
def toLDAPURL(self):
return "ldap://%s:%d/" % (self.host,self.port)
@@ -345,7 +345,7 @@ class IPAdmin(SimpleLDAPObject):
self.__handle_errors(e, **kw)
if not obj:
- raise errors2.NotFound(msg=notfound(args))
+ raise errors.NotFound(msg=notfound(args))
elif isinstance(obj,Entry):
return obj
@@ -367,7 +367,7 @@ class IPAdmin(SimpleLDAPObject):
self.__handle_errors(e, **kw)
if not obj:
- raise errors2.NotFound(msg=notfound(args))
+ raise errors.NotFound(msg=notfound(args))
entries = []
for s in obj:
@@ -405,7 +405,7 @@ class IPAdmin(SimpleLDAPObject):
self.__handle_errors(e, **kw)
if not entries:
- raise errors2.NotFound(msg=notfound(args))
+ raise errors.NotFound(msg=notfound(args))
if partial == 1:
counter = -1
diff --git a/ipaserver/plugins/ldap2.py b/ipaserver/plugins/ldap2.py
index c3146085..8b5983ae 100644
--- a/ipaserver/plugins/ldap2.py
+++ b/ipaserver/plugins/ldap2.py
@@ -45,7 +45,7 @@ from ldap.controls import LDAPControl
from ldap.ldapobject import SimpleLDAPObject
from ipalib import api
-from ipalib import errors2
+from ipalib import errors
from ipalib.crud import CrudBackend
# attribute syntax to python type mapping, 'SYNTAX OID': type
@@ -93,31 +93,31 @@ def _handle_errors(self, e, **kw):
raise e
except _ldap.NO_SUCH_OBJECT, e:
# args = kw.get('args', '')
- # raise errors2.NotFound(msg=notfound(args))
- raise errors2.NotFound()
+ # raise errors.NotFound(msg=notfound(args))
+ raise errors.NotFound()
except _ldap.ALREADY_EXISTS, e:
- raise errors2.DuplicateEntry()
+ raise errors.DuplicateEntry()
except _ldap.CONSTRAINT_VIOLATION, e:
# This error gets thrown by the uniqueness plugin
if info == 'Another entry with the same attribute value already exists':
- raise errors2.DuplicateEntry()
+ raise errors.DuplicateEntry()
else:
- raise errors2.DatabaseError(desc=desc, info=info)
+ raise errors.DatabaseError(desc=desc, info=info)
except _ldap.INSUFFICIENT_ACCESS, e:
- raise errors2.ACIError(info=info)
+ raise errors.ACIError(info=info)
except _ldap.NO_SUCH_ATTRIBUTE:
# this is raised when a 'delete' attribute isn't found.
# it indicates the previous attribute was removed by another
# update, making the oldentry stale.
- raise errors2.MidairCollision()
+ raise errors.MidairCollision()
except _ldap.ADMINLIMIT_EXCEEDED, e:
- raise errors2.LimitsExceeded()
+ raise errors.LimitsExceeded()
except _ldap.SIZELIMIT_EXCEEDED, e:
- raise errors2.LimitsExceeded()
+ raise errors.LimitsExceeded()
except _ldap.TIMELIMIT_EXCEEDED, e:
- raise errors2.LimitsExceeded()
+ raise errors.LimitsExceeded()
except _ldap.LDAPError, e:
- raise errors2.DatabaseError(desc=desc, info=info)
+ raise errors.DatabaseError(desc=desc, info=info)
# utility function, builds LDAP URL string
def _get_url(host, port, using_cacert=False):
@@ -458,7 +458,7 @@ class ldap2(CrudBackend):
except _ldap.LDAPError, e:
_handle_errors(e, **{})
if not res:
- raise errors2.NotFound()
+ raise errors.NotFound()
# decode results
for i in xrange(len(res)):
@@ -553,7 +553,7 @@ class ldap2(CrudBackend):
# generate modlist
modlist = self._generate_modlist(dn, entry_attrs_copy)
if not modlist:
- raise errors2.EmptyModlist()
+ raise errors.EmptyModlist()
# pass arguments to python-ldap
try:
@@ -594,7 +594,7 @@ class ldap2(CrudBackend):
group_dn = self.normalize_dn(group_dn)
# check if we're not trying to add group into itself
if dn == group_dn:
- raise errors2.SameGroupError()
+ raise errors.SameGroupError()
# check if the entry exists
(dn, entry_attrs) = self.get_entry(dn, ['objectClass'])
@@ -609,8 +609,8 @@ class ldap2(CrudBackend):
# update group entry
try:
self.update_entry(group_dn, group_entry_attrs)
- except errors2.EmptyModlist:
- raise errors2.AlreadyGroupMember()
+ except errors.EmptyModlist:
+ raise errors.AlreadyGroupMember()
def remove_entry_from_group(self, dn, group_dn, member_attr='member'):
"""Remove entry from group."""
@@ -625,7 +625,7 @@ class ldap2(CrudBackend):
try:
members.remove(dn)
except ValueError:
- raise errors2.NotGroupMember()
+ raise errors.NotGroupMember()
group_entry_attrs[member_attr] = members
# update group entry
@@ -642,10 +642,10 @@ class ldap2(CrudBackend):
account_lock_attr = account_lock_attr[0].lower()
if active:
if account_lock_attr == 'false':
- raise errors2.AlreadyActive()
+ raise errors.AlreadyActive()
else:
if account_lock_attr == 'true':
- raise errors2.AlreadyInactive()
+ raise errors.AlreadyInactive()
# check if nsAccountLock attribute is in the entry itself
is_member = False
@@ -655,7 +655,7 @@ class ldap2(CrudBackend):
is_member = True
break
if not is_member and entry_attrs.has_key('nsAccountLock'):
- raise errors2.HasNSAccountLock()
+ raise errors.HasNSAccountLock()
activated_filter = '(cn=activated)'
inactivated_filter = '(cn=inactivated)'
@@ -669,7 +669,7 @@ class ldap2(CrudBackend):
(group_dn, group_entry_attrs) = entries[0]
try:
self.remove_entry_from_group(dn, group_dn)
- except errors2.NotGroupMember:
+ except errors.NotGroupMember:
pass
# add the entry to the activated/inactivated group if necessary
@@ -688,11 +688,11 @@ class ldap2(CrudBackend):
(group_dn, group_entry_attrs) = entries[0]
try:
self.add_entry_to_group(dn, group_dn)
- except errors2.EmptyModlist:
+ except errors.EmptyModlist:
if active:
- raise errors2.AlreadyActive()
+ raise errors.AlreadyActive()
else:
- raise errors2.AlreadyInactive()
+ raise errors.AlreadyInactive()
def activate_entry(self, dn):
"""Mark entry active."""
diff --git a/ipaserver/plugins/ldapapi.py b/ipaserver/plugins/ldapapi.py
index 9eea3eaa..995abe38 100644
--- a/ipaserver/plugins/ldapapi.py
+++ b/ipaserver/plugins/ldapapi.py
@@ -27,7 +27,7 @@ This wraps the python-ldap bindings.
import ldap as _ldap
import ldap.dn
from ipalib import api
-from ipalib import errors2
+from ipalib import errors
from ipalib.crud import CrudBackend
from ipaserver import servercore, ipaldap
import krbV
@@ -44,7 +44,7 @@ class ldap(CrudBackend):
def create_connection(self, ccache):
if ccache is None:
- raise errors2.CCacheError()
+ raise errors.CCacheError()
conn = ipaldap.IPAdmin(self.env.ldap_host, self.env.ldap_port)
principle = krbV.CCache(
name=ccache, context=krbV.default_context()
@@ -326,7 +326,7 @@ class ldap(CrudBackend):
def create(self, **kw):
if servercore.entry_exists(kw['dn']):
- raise errors2.DuplicateEntry
+ raise errors.DuplicateEntry
kw = dict(self.strip_none(kw))
entry = ipaldap.Entry(kw['dn'])
@@ -409,14 +409,14 @@ class ldap(CrudBackend):
try:
exact_results = servercore.search(search_base,
exact_match_filter, attributes, scope=search_scope)
- except errors2.NotFound:
+ except errors.NotFound:
exact_results = [0]
if not exactonly:
try:
partial_results = servercore.search(search_base,
partial_match_filter, attributes, scope=search_scope)
- except errors2.NotFound:
+ except errors.NotFound:
partial_results = [0]
else:
partial_results = [0]
diff --git a/ipaserver/plugins/ra.py b/ipaserver/plugins/ra.py
index 71f7a97c..de14cbd3 100644
--- a/ipaserver/plugins/ra.py
+++ b/ipaserver/plugins/ra.py
@@ -45,7 +45,7 @@ from urllib import urlencode, quote
from socket import gethostname
import socket
from ipalib import Backend
-from ipalib.errors2 import NetworkError
+from ipalib.errors import NetworkError
from ipaserver import servercore
from ipaserver import ipaldap
from ipalib.constants import TYPE_ERROR
diff --git a/ipaserver/rpcserver.py b/ipaserver/rpcserver.py
index 2ad233dc..68d8215f 100644
--- a/ipaserver/rpcserver.py
+++ b/ipaserver/rpcserver.py
@@ -25,7 +25,7 @@ Also see the `ipalib.rpc` module.
from xmlrpclib import Fault
from ipalib.backend import Executioner
-from ipalib.errors2 import PublicError, InternalError, CommandError
+from ipalib.errors import PublicError, InternalError, CommandError
from ipalib.rpc import xml_dumps, xml_loads
from ipalib.util import make_repr
diff --git a/ipaserver/servercore.py b/ipaserver/servercore.py
index ee0e518d..1e0972d7 100644
--- a/ipaserver/servercore.py
+++ b/ipaserver/servercore.py
@@ -23,7 +23,7 @@ import re
from ipalib.request import context
from ipaserver import ipaldap
import ipautil
-from ipalib import errors2
+from ipalib import errors
from ipalib import api
def convert_entry(ent):
@@ -186,7 +186,7 @@ def entry_exists(dn):
try:
get_base_entry(dn, "objectclass=*", ['dn','objectclass'])
return True
- except errors2.NotFound:
+ except errors.NotFound:
return False
def get_user_by_uid (uid, sattrs):
@@ -270,7 +270,7 @@ def search(base, filter, attributes, timelimit=1, sizelimit=3000, scope=ldap.SCO
results = context.ldap.conn.getListAsync(base, scope,
filter, attributes, 0, None, None, timelimit, sizelimit)
except ldap.NO_SUCH_OBJECT:
- raise errors2.NotFound()
+ raise errors.NotFound()
counter = results[0]
entries = [counter]
@@ -317,7 +317,7 @@ def get_ipa_config():
config = get_sub_entry("cn=etc," + api.env.basedn, searchfilter)
except ldap.NO_SUCH_OBJECT, e:
# FIXME
- raise errors2.NotFound()
+ raise errors.NotFound()
return config
@@ -341,16 +341,16 @@ def mark_entry_active (dn):
if entry.get('nsaccountlock', 'false').lower() == "false":
api.log.debug("IPA: already active")
- raise errors2.AlreadyActive()
+ raise errors.AlreadyActive()
if has_nsaccountlock(dn):
api.log.debug("IPA: appears to have the nsaccountlock attribute")
- raise errors2.HasNSAccountLock()
+ raise errors.HasNSAccountLock()
group = get_entry_by_cn("inactivated", None)
try:
remove_member_from_group(entry.get('dn'), group.get('dn'))
- except errors2.NotGroupMember:
+ except errors.NotGroupMember:
# Perhaps the user is there as a result of group membership
pass
@@ -377,18 +377,18 @@ def mark_entry_inactive (dn):
if entry.get('nsaccountlock', 'false').lower() == "true":
api.log.debug("IPA: already marked as inactive")
- raise errors2.AlreadyInactive()
+ raise errors.AlreadyInactive()
if has_nsaccountlock(dn):
api.log.debug("IPA: appears to have the nsaccountlock attribute")
- raise errors2.HasNSAccountLock()
+ raise errors.HasNSAccountLock()
# First see if they are in the activated group as this will override
# the our inactivation.
group = get_entry_by_cn("activated", None)
try:
remove_member_from_group(dn, group.get('dn'))
- except errors2.NotGroupMember:
+ except errors.NotGroupMember:
# this is fine, they may not be explicitly in this group
pass
@@ -405,16 +405,16 @@ def add_member_to_group(member_dn, group_dn, memberattr='member'):
api.log.info("IPA: add_member_to_group '%s' to '%s'" % (member_dn, group_dn))
if member_dn.lower() == group_dn.lower():
# You can't add a group to itself
- raise errors2.RecursiveGroup()
+ raise errors.RecursiveGroup()
group = get_entry_by_dn(group_dn, None)
if group is None:
- raise errors2.NotFound()
+ raise errors.NotFound()
# check to make sure member_dn exists
member_entry = get_base_entry(member_dn, "(objectClass=*)", ['dn','objectclass'])
if not member_entry:
- raise errors2.NotFound()
+ raise errors.NotFound()
# Add the new member to the group member attribute
members = group.get(memberattr, [])
@@ -430,7 +430,7 @@ def remove_member_from_group(member_dn, group_dn, memberattr='member'):
group = get_entry_by_dn(group_dn, None)
if group is None:
- raise errors2.NotFound()
+ raise errors.NotFound()
"""
if group.get('cn') == "admins":
member = get_entry_by_dn(member_dn, ['dn','uid'])
@@ -441,7 +441,7 @@ def remove_member_from_group(member_dn, group_dn, memberattr='member'):
members = group.get(memberattr, False)
if not members:
- raise errors2.NotGroupMember()
+ raise errors.NotGroupMember()
if isinstance(members,basestring):
members = [members]
@@ -450,7 +450,7 @@ def remove_member_from_group(member_dn, group_dn, memberattr='member'):
try:
members.remove(member_dn)
except ValueError:
- raise errors2.NotGroupMember()
+ raise errors.NotGroupMember()
except Exception, e:
raise e