diff options
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/__init__.py | 2 | ||||
-rw-r--r-- | ipalib/backend.py | 2 | ||||
-rw-r--r-- | ipalib/cli.py | 2 | ||||
-rw-r--r-- | ipalib/errors.py (renamed from ipalib/errors2.py) | 0 | ||||
-rw-r--r-- | ipalib/frontend.py | 4 | ||||
-rw-r--r-- | ipalib/parameters.py | 2 | ||||
-rw-r--r-- | ipalib/plugable.py | 20 | ||||
-rw-r--r-- | ipalib/plugins/aci.py | 28 | ||||
-rw-r--r-- | ipalib/plugins/automount.py | 12 | ||||
-rw-r--r-- | ipalib/plugins/basegroup.py | 4 | ||||
-rw-r--r-- | ipalib/plugins/group.py | 4 | ||||
-rw-r--r-- | ipalib/plugins/host.py | 6 | ||||
-rw-r--r-- | ipalib/plugins/join.py | 8 | ||||
-rw-r--r-- | ipalib/plugins/passwd.py | 4 | ||||
-rw-r--r-- | ipalib/plugins/service.py | 10 | ||||
-rw-r--r-- | ipalib/plugins/user.py | 6 | ||||
-rw-r--r-- | ipalib/plugins/user2.py | 14 | ||||
-rw-r--r-- | ipalib/rpc.py | 18 | ||||
-rw-r--r-- | ipalib/util.py | 4 |
19 files changed, 75 insertions, 75 deletions
diff --git a/ipalib/__init__.py b/ipalib/__init__.py index b2fc1f857..a657ea974 100644 --- a/ipalib/__init__.py +++ b/ipalib/__init__.py @@ -878,7 +878,7 @@ from frontend import Object, Method, Property from crud import Create, Retrieve, Update, Delete, Search from parameters import DefaultFrom, Bool, Flag, Int, Float, Bytes, Str, Password,List from parameters import BytesEnum, StrEnum -from errors2 import SkipPluginModule +from errors import SkipPluginModule try: import uuid diff --git a/ipalib/backend.py b/ipalib/backend.py index 7bd9a29f8..03dae1ced 100644 --- a/ipalib/backend.py +++ b/ipalib/backend.py @@ -23,7 +23,7 @@ Base classes for all backed-end plugins. import threading import plugable -from errors2 import PublicError, InternalError, CommandError +from errors import PublicError, InternalError, CommandError from request import context, Connection, destroy_context diff --git a/ipalib/cli.py b/ipalib/cli.py index 6a1a6d0ff..4949a9b9f 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -36,7 +36,7 @@ import frontend import backend import plugable import util -from errors2 import PublicError, CommandError, HelpError, InternalError, NoSuchNamespaceError, ValidationError +from errors import PublicError, CommandError, HelpError, InternalError, NoSuchNamespaceError, ValidationError from constants import CLI_TAB from parameters import Password, Bytes from request import ugettext as _ diff --git a/ipalib/errors2.py b/ipalib/errors.py index f626f359d..f626f359d 100644 --- a/ipalib/errors2.py +++ b/ipalib/errors.py diff --git a/ipalib/frontend.py b/ipalib/frontend.py index c2f68d471..aeae24ca0 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -28,7 +28,7 @@ from plugable import lock, check_name from parameters import create_param, Param, Str, Flag, Password from util import make_repr -from errors2 import ZeroArgumentError, MaxArgumentError, OverlapError +from errors import ZeroArgumentError, MaxArgumentError, OverlapError from constants import TYPE_ERROR @@ -294,7 +294,7 @@ class Command(plugable.Plugin): """ Validate all values. - If any value fails the validation, `ipalib.errors2.ValidationError` + If any value fails the validation, `ipalib.errors.ValidationError` (or a subclass thereof) will be raised. """ for param in self.params(): diff --git a/ipalib/parameters.py b/ipalib/parameters.py index e5f4e8ef1..13fd50b59 100644 --- a/ipalib/parameters.py +++ b/ipalib/parameters.py @@ -34,7 +34,7 @@ from types import NoneType from util import make_repr from request import ugettext from plugable import ReadOnly, lock, check_name -from errors2 import ConversionError, RequirementError, ValidationError +from errors import ConversionError, RequirementError, ValidationError from constants import NULLS, TYPE_ERROR, CALLABLE_ERROR import csv diff --git a/ipalib/plugable.py b/ipalib/plugable.py index 213b59783..c0a4c3567 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -34,7 +34,7 @@ import os from os import path import subprocess import optparse -import errors2 +import errors from config import Env import util from base import ReadOnly, NameSpace, lock, islocked, check_name @@ -283,7 +283,7 @@ class Plugin(ReadOnly): Call ``executable`` with ``args`` using subprocess.call(). If the call exits with a non-zero exit status, - `ipalib.errors2.SubprocessError` is raised, from which you can retrieve + `ipalib.errors.SubprocessError` is raised, from which you can retrieve the exit code by checking the SubprocessError.returncode attribute. This method does *not* return what ``executable`` sent to stdout... for @@ -293,7 +293,7 @@ class Plugin(ReadOnly): self.debug('Calling %r', argv) code = subprocess.call(argv) if code != 0: - raise errors2.SubprocessError(returncode=code, argv=argv) + raise errors.SubprocessError(returncode=code, argv=argv) def __repr__(self): """ @@ -450,7 +450,7 @@ class Registrar(DictProxy): """ Iterates through allowed bases that ``klass`` is a subclass of. - Raises `errors2.PluginSubclassError` if ``klass`` is not a subclass of + Raises `errors.PluginSubclassError` if ``klass`` is not a subclass of any allowed base. :param klass: The plugin class to find bases for. @@ -462,7 +462,7 @@ class Registrar(DictProxy): found = True yield (base, sub_d) if not found: - raise errors2.PluginSubclassError( + raise errors.PluginSubclassError( plugin=klass, bases=self.__allowed.keys() ) @@ -478,7 +478,7 @@ class Registrar(DictProxy): # Raise DuplicateError if this exact class was already registered: if klass in self.__registered: - raise errors2.PluginDuplicateError(plugin=klass) + raise errors.PluginDuplicateError(plugin=klass) # Find the base class or raise SubclassError: for (base, sub_d) in self.__findbases(klass): @@ -486,7 +486,7 @@ class Registrar(DictProxy): if klass.__name__ in sub_d: if not override: # Must use override=True to override: - raise errors2.PluginOverrideError( + raise errors.PluginOverrideError( base=base.__name__, name=klass.__name__, plugin=klass, @@ -494,7 +494,7 @@ class Registrar(DictProxy): else: if override: # There was nothing already registered to override: - raise errors2.PluginMissingOverrideError( + raise errors.PluginMissingOverrideError( base=base.__name__, name=klass.__name__, plugin=klass, @@ -667,7 +667,7 @@ class API(DictProxy): parent_dir = path.dirname(path.abspath(parent.__file__)) plugins_dir = path.dirname(path.abspath(plugins.__file__)) if parent_dir == plugins_dir: - raise errors2.PluginsPackageError( + raise errors.PluginsPackageError( name=subpackage, file=plugins.__file__ ) self.log.debug('importing all plugin modules in %r...', plugins_dir) @@ -676,7 +676,7 @@ class API(DictProxy): self.log.debug('importing plugin module %r', pyfile) try: __import__(fullname) - except errors2.SkipPluginModule, e: + except errors.SkipPluginModule, e: self.log.info( 'skipping plugin module %s: %s', fullname, e.reason ) diff --git a/ipalib/plugins/aci.py b/ipalib/plugins/aci.py index 6a2a1c2d7..8587e2ae9 100644 --- a/ipalib/plugins/aci.py +++ b/ipalib/plugins/aci.py @@ -21,7 +21,7 @@ Frontend plugins for managing DS ACIs """ -from ipalib import api, crud, errors2 +from ipalib import api, crud, errors from ipalib import Object, Command # Plugin base classes from ipalib import Str, Flag, Int, StrEnum # Parameter types from ipalib.aci import ACI @@ -35,7 +35,7 @@ type_map = { def make_aci(current, aciname, kw): try: taskgroup = api.Command['taskgroup_show'](kw['taskgroup']) - except errors2.NotFound: + except errors.NotFound: # The task group doesn't exist, let's be helpful and add it tgkw = {'description':aciname} taskgroup = api.Command['taskgroup_add'](kw['taskgroup'], **tgkw) @@ -81,7 +81,7 @@ def search_by_name(acis, aciname): # FIXME: need to log syntax errors, ignore for now pass - raise errors2.NotFound() + raise errors.NotFound() def search_by_attr(acis, attrlist): """ @@ -105,7 +105,7 @@ def search_by_attr(acis, attrlist): if results: return results - raise errors2.NotFound() + raise errors.NotFound() def search_by_taskgroup(acis, tgdn): """ @@ -126,7 +126,7 @@ def search_by_taskgroup(acis, tgdn): if results: return results - raise errors2.NotFound() + raise errors.NotFound() def search_by_perm(acis, permlist): """ @@ -148,7 +148,7 @@ def search_by_perm(acis, permlist): if results: return results - raise errors2.NotFound() + raise errors.NotFound() def search_by_memberof(acis, memberoffilter): """ @@ -174,7 +174,7 @@ def search_by_memberof(acis, memberoffilter): if results: return results - raise errors2.NotFound() + raise errors.NotFound() class aci(Object): """ @@ -241,7 +241,7 @@ class aci_add(crud.Create): try: b = ACI(a) if newaci.isequal(b): - raise errors2.DuplicateEntry() + raise errors.DuplicateEntry() except SyntaxError: pass acilist.append(str(newaci)) @@ -318,7 +318,7 @@ class aci_find(crud.Search): results = [a] if kw.get('and'): currentaci = results - except errors2.NotFound: + except errors.NotFound: if kw.get('and'): results = [] currentaci = [] @@ -335,7 +335,7 @@ class aci_find(crud.Search): currentaci = results else: results = results + a - except errors2.NotFound: + except errors.NotFound: if kw.get('and'): results = [] currentaci = [] @@ -345,7 +345,7 @@ class aci_find(crud.Search): if kw.get('taskgroup'): try: tg = api.Command['taskgroup_show'](kw.get('taskgroup')) - except errors2.NotFound: + except errors.NotFound: # FIXME, need more precise error raise try: @@ -355,7 +355,7 @@ class aci_find(crud.Search): currentaci = results else: results = results + a - except errors2.NotFound: + except errors.NotFound: if kw.get('and'): results = [] currentaci = [] @@ -372,7 +372,7 @@ class aci_find(crud.Search): currentaci = results else: results = results + a - except errors2.NotFound: + except errors.NotFound: if kw.get('and'): results = [] currentaci = [] @@ -387,7 +387,7 @@ class aci_find(crud.Search): results = results + a if kw.get('and'): currentaci = results - except errors2.NotFound: + except errors.NotFound: if kw.get('and'): results = [] currentaci = [] diff --git a/ipalib/plugins/automount.py b/ipalib/plugins/automount.py index b4b696d10..6378a1385 100644 --- a/ipalib/plugins/automount.py +++ b/ipalib/plugins/automount.py @@ -86,7 +86,7 @@ automountInformation: -ro,soft,rsize=8192,wsize=8192 nfs.example.com:/vol/arch """ from ldap import explode_dn -from ipalib import crud, errors2 +from ipalib import crud, errors from ipalib import api, Str, Flag, Object, Command map_attributes = ['automountMapName', 'description', ] @@ -251,7 +251,7 @@ class automount_delmap(crud.Del): try: infodn = ldap.find_entry_dn("automountinformation", mapname, "automount", api.env.container_automount) ldap.delete(infodn) - except errors2.NotFound: + except errors.NotFound: # direct maps may not have this pass @@ -291,7 +291,7 @@ class automount_delkey(crud.Del): keydn = k.get('dn') break if not keydn: - raise errors2.NotFound(msg='Entry not found') + raise errors.NotFound(msg='Entry not found') return ldap.delete(keydn) def output_for_cli(self, textui, result, *args, **options): """ @@ -369,7 +369,7 @@ class automount_modkey(crud.Mod): keydn = k.get('dn') break if not keydn: - raise errors2.NotFound(msg='Entry not found') + raise errors.NotFound(msg='Entry not found') return ldap.update(keydn, **kw) def output_for_cli(self, textui, result, *args, **options): @@ -517,7 +517,7 @@ class automount_showkey(crud.Get): keydn = k.get('dn') break if not keydn: - raise errors2.NotFound(msg='Entry not found') + raise errors.NotFound(msg='Entry not found') # FIXME: should kw contain the list of attributes to display? if kw.get('all', False): return ldap.retrieve(keydn) @@ -558,7 +558,7 @@ class automount_getkeys(Command): dn = ldap.find_entry_dn("automountmapname", mapname, "automountmap", api.env.container_automount) try: keys = ldap.get_one_entry(dn, 'objectclass=*', ['*']) - except errors2.NotFound: + except errors.NotFound: keys = [] return keys diff --git a/ipalib/plugins/basegroup.py b/ipalib/plugins/basegroup.py index b93fdc8d9..733a6c384 100644 --- a/ipalib/plugins/basegroup.py +++ b/ipalib/plugins/basegroup.py @@ -21,7 +21,7 @@ Base plugin for groups. """ -from ipalib import api, crud, errors2 +from ipalib import api, crud, errors from ipalib import Object, Command # Plugin base classes from ipalib import Str, Int, Flag, List # Parameter types from ldap.dn import escape_dn_chars @@ -50,7 +50,7 @@ def find_members(ldap, failed, members, attribute, filter=None, base=None): try: member_dn = ldap.find_entry_dn(attribute, m, filter, base) found.append(member_dn) - except errors2.NotFound: + except errors.NotFound: failed.append(m) return found, failed diff --git a/ipalib/plugins/group.py b/ipalib/plugins/group.py index 3bf5221fe..766d1679f 100644 --- a/ipalib/plugins/group.py +++ b/ipalib/plugins/group.py @@ -119,7 +119,7 @@ class group_del(basegroup_del): default_group = ldap.find_entry_dn("cn", config.get('ipadefaultprimarygroup'), self.filter_class) if dn == default_group: raise errors.DefaultGroup - except errors2.NotFound: + except errors.NotFound: pass return super(group_del, self).execute(cn, **kw) @@ -160,7 +160,7 @@ class group_mod(basegroup_mod): groupkw = {'all': True} oldgroup = api.Command['group_show'](cn, **groupkw) if oldgroup.get('gidnumber'): - raise errors2.AlreadyPosixGroup + raise errors.AlreadyPosixGroup else: oldgroup['objectclass'].append('posixgroup') kw['objectclass'] = oldgroup['objectclass'] diff --git a/ipalib/plugins/host.py b/ipalib/plugins/host.py index 13a0254e3..87180733f 100644 --- a/ipalib/plugins/host.py +++ b/ipalib/plugins/host.py @@ -21,7 +21,7 @@ Frontend plugins for host/machine Identity. """ -from ipalib import api, crud, errors2, util +from ipalib import api, crud, errors, util from ipalib import Object # Plugin base class from ipalib import Str, Flag # Parameter types import sys, os, platform @@ -39,7 +39,7 @@ def get_host(hostname): hostname = hostname[:-1] try: dn = ldap.find_entry_dn("cn", hostname, "ipaHost") - except errors2.NotFound: + except errors.NotFound: dn = ldap.find_entry_dn("serverhostname", hostname, "ipaHost") return dn @@ -138,7 +138,7 @@ class host_add(crud.Add): current = util.get_current_principal() if not current: - raise errors2.NotFound('Unable to determine current user') + raise errors.NotFound('Unable to determine current user') kw['enrolledby'] = ldap.find_entry_dn("krbPrincipalName", current, "posixAccount") # Get our configuration diff --git a/ipalib/plugins/join.py b/ipalib/plugins/join.py index 1230d5bcc..d75043fdd 100644 --- a/ipalib/plugins/join.py +++ b/ipalib/plugins/join.py @@ -23,7 +23,7 @@ Machine join from ipalib import api, util from ipalib import Command, Str, Int -from ipalib import errors2 +from ipalib import errors import krbV import os, subprocess @@ -74,10 +74,10 @@ class join(Command): try: host = api.Command['host_show'](hostname) - except errors2.NotFound: + except errors.NotFound: pass else: - raise errors2.DuplicateEntry + raise errors.DuplicateEntry return api.Command['host_add'](hostname) @@ -91,7 +91,7 @@ class join(Command): """ if not self.env.in_server: # if os.getegid() != 0: -# raise errors2.RequiresRoot +# raise errors.RequiresRoot result = self.forward(*args, **options) else: return self.execute(*args, **options) diff --git a/ipalib/plugins/passwd.py b/ipalib/plugins/passwd.py index cc7ab5861..bb6e637a9 100644 --- a/ipalib/plugins/passwd.py +++ b/ipalib/plugins/passwd.py @@ -21,7 +21,7 @@ Frontend plugins for password changes. """ -from ipalib import api, errors2, util +from ipalib import api, errors, util from ipalib import Command # Plugin base classes from ipalib import Str, Password # Parameter types @@ -54,7 +54,7 @@ class passwd(Command): if principal.find('@') > 0: u = principal.split('@') if len(u) > 2: - raise errors2.MalformedUserPrincipal(principal=principal) + raise errors.MalformedUserPrincipal(principal=principal) else: principal = principal+"@"+self.api.env.realm dn = self.Backend.ldap.find_entry_dn( diff --git a/ipalib/plugins/service.py b/ipalib/plugins/service.py index 4c6f5bd80..c9f00deb2 100644 --- a/ipalib/plugins/service.py +++ b/ipalib/plugins/service.py @@ -22,7 +22,7 @@ Frontend plugins for service (Identity). """ -from ipalib import api, crud, errors2 +from ipalib import api, crud, errors from ipalib import Object # Plugin base classes from ipalib import Str, Flag # Parameter types @@ -73,11 +73,11 @@ class service_add(crud.Add): # may not include the realm. sp = principal.split('/') if len(sp) != 2: - raise errors2.MalformedServicePrincipal + raise errors.MalformedServicePrincipal service = sp[0] if service.lower() == "host": - raise errors2.HostService + raise errors.HostService sr = sp[1].split('@') if len(sr) == 1: @@ -87,7 +87,7 @@ class service_add(crud.Add): hostname = sr[0].lower() realm = sr[1] else: - raise errors2.MalformedServicePrincipal + raise errors.MalformedServicePrincipal """ FIXME once DNS client is done @@ -103,7 +103,7 @@ class service_add(crud.Add): # At some point we'll support multiple realms if (realm != self.api.env.realm): - raise errors2.RealmMismatch + raise errors.RealmMismatch # Put the principal back together again princ_name = service + "/" + hostname + "@" + realm diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py index e4e1cdaf1..be70e7bee 100644 --- a/ipalib/plugins/user.py +++ b/ipalib/plugins/user.py @@ -21,7 +21,7 @@ Frontend plugins for user (Identity). """ -from ipalib import api, crud, errors2 +from ipalib import api, crud, errors from ipalib import Object, Command # Plugin base classes from ipalib import Str, Password, Flag, Int # Parameter types @@ -158,9 +158,9 @@ class user_add(crud.Create): default_group = ldap.retrieve(group_dn, ['cn', 'dn','gidNumber']) if default_group: kw['gidnumber'] = default_group.get('gidnumber') - except errors2.NotFound: + except errors.NotFound: # Fake an LDAP error so we can return something useful to the kw - raise errors2.NotFound("The default group for new users, '%s', cannot be found." % config.get('ipadefaultprimarygroup')) + raise errors.NotFound("The default group for new users, '%s', cannot be found." % config.get('ipadefaultprimarygroup')) except Exception, e: # catch everything else raise e diff --git a/ipalib/plugins/user2.py b/ipalib/plugins/user2.py index 13bd37f5a..b322aa87d 100644 --- a/ipalib/plugins/user2.py +++ b/ipalib/plugins/user2.py @@ -21,7 +21,7 @@ Users (Identity) """ -from ipalib import api, crud, errors2 +from ipalib import api, crud, errors from ipalib import Command, Object from ipalib import Flag, Int, Password, Str @@ -146,9 +146,9 @@ class user2_create(crud.Create): # try to retrieve the group's gidNumber try: (group_dn, group_attrs) = ldap.get_entry(group_dn, ['gidNumber']) - except errors2.NotFound: + except errors.NotFound: error_msg = 'Default group for new users not found.' - raise errors2.NotFound(error_msg) + raise errors.NotFound(error_msg) # fill default group's gidNumber entry_attrs['gidnumber'] = group_attrs['gidNumber'] @@ -184,7 +184,7 @@ class user2_delete(crud.Delete): if uid == 'admin': # FIXME: add a specific exception for this? - raise errors2.ExecutionError('Cannot delete user "admin".') + raise errors.ExecutionError('Cannot delete user "admin".') # build entry DN rdn = ldap.make_rdn_from_attr('uid', uid) @@ -276,7 +276,7 @@ class user2_find(crud.Search): entries = ldap.find_entries( filter, attrs_list, _container_dn, ldap.SCOPE_ONELEVEL ) - except errors2.NotFound: + except errors.NotFound: entries = tuple() return entries @@ -355,7 +355,7 @@ class user2_lock(Command): # lock! try: ldap.deactivate_entry(dn) - except errors2.AlreadyInactive: + except errors.AlreadyInactive: pass # return something positive @@ -391,7 +391,7 @@ class user2_unlock(Command): # unlock! try: ldap.activate_entry(dn) - except errors2.AlreadyActive: + except errors.AlreadyActive: pass # return something positive diff --git a/ipalib/rpc.py b/ipalib/rpc.py index b0b55ce59..48ac16b5a 100644 --- a/ipalib/rpc.py +++ b/ipalib/rpc.py @@ -38,8 +38,8 @@ import errno from xmlrpclib import Binary, Fault, dumps, loads, ServerProxy, Transport import kerberos from ipalib.backend import Connectible -from ipalib.errors2 import public_errors, PublicError, UnknownError, NetworkError -from ipalib import errors2 +from ipalib.errors import public_errors, PublicError, UnknownError, NetworkError +from ipalib import errors from ipalib.request import context from ipapython import ipautil from OpenSSL import SSL @@ -316,19 +316,19 @@ class KerbTransport(SSLTransport): def _handle_exception(self, e, service=None): (major, minor) = ipautil.get_gsserror(e) if minor[1] == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN: - raise errors2.ServiceError(service=service) + raise errors.ServiceError(service=service) elif minor[1] == KRB5_FCC_NOFILE: - raise errors2.NoCCacheError() + raise errors.NoCCacheError() elif minor[1] == KRB5KRB_AP_ERR_TKT_EXPIRED: - raise errors2.TicketExpired() + raise errors.TicketExpired() elif minor[1] == KRB5_FCC_PERM: - raise errors2.BadCCachePerms() + raise errors.BadCCachePerms() elif minor[1] == KRB5_CC_FORMAT: - raise errors2.BadCCacheFormat() + raise errors.BadCCacheFormat() elif minor[1] == KRB5_REALM_CANT_RESOLVE: - raise errors2.CannotResolveKDC() + raise errors.CannotResolveKDC() else: - raise errors2.KerberosError(major=major, minor=minor) + raise errors.KerberosError(major=major, minor=minor) def get_host_info(self, host): (host, extra_headers, x509) = SSLTransport.get_host_info(self, host) diff --git a/ipalib/util.py b/ipalib/util.py index 54529b14c..5ea13dc8c 100644 --- a/ipalib/util.py +++ b/ipalib/util.py @@ -28,7 +28,7 @@ import logging import time import krbV import socket -from ipalib import errors2 +from ipalib import errors def get_current_principal(): @@ -36,7 +36,7 @@ def get_current_principal(): return unicode(krbV.default_context().default_ccache().principal().name) except krbV.Krb5Error: #TODO: do a kinit? - raise errors2.CCacheError() + raise errors.CCacheError() def get_fqdn(): fqdn = "" |