From 7d0bd4b8951ef7894668ad3c63607769e208c9d0 Mon Sep 17 00:00:00 2001 From: Pavel Zuna Date: Thu, 23 Apr 2009 14:51:59 +0200 Subject: Rename errors2.py to errors.py. Modify all affected files. --- ipalib/plugins/aci.py | 28 ++++++++++++++-------------- ipalib/plugins/automount.py | 12 ++++++------ ipalib/plugins/basegroup.py | 4 ++-- ipalib/plugins/group.py | 4 ++-- ipalib/plugins/host.py | 6 +++--- ipalib/plugins/join.py | 8 ++++---- ipalib/plugins/passwd.py | 4 ++-- ipalib/plugins/service.py | 10 +++++----- ipalib/plugins/user.py | 6 +++--- ipalib/plugins/user2.py | 14 +++++++------- 10 files changed, 48 insertions(+), 48 deletions(-) (limited to 'ipalib/plugins') 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 -- cgit