From 9d84a3cf49906548390845b4c30482d702f679bf Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Thu, 20 Sep 2012 14:02:15 +0300 Subject: [PATCH] Fix error messages and use proper ImportError for dcerpc import --- ipalib/plugins/group.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ipalib/plugins/group.py b/ipalib/plugins/group.py index 011587206..ae00aa8ac 100644 --- a/ipalib/plugins/group.py +++ b/ipalib/plugins/group.py @@ -26,7 +26,7 @@ if api.env.in_server and api.env.context in ['lite', 'server']: try: import ipaserver.dcerpc _dcerpc_bindings_installed = True - except Exception, e: + except ImportError: _dcerpc_bindings_installed = False __doc__ = _(""" @@ -328,14 +328,13 @@ class group_add_member(LDAPAddMember): result = (completed, dn) if 'ipaexternalmember' in options: if not _dcerpc_bindings_installed: - raise errors.NotFound(name=_('AD Trust'), - reason=_('''Cannot perform external member validation without Samba 4 support installed. - Make sure you have installed server-trust-ad sub-package of IPA on the server''')) + raise errors.NotFound(reason=_('Cannot perform external member validation without ' + 'Samba 4 support installed. Make sure you have installed ' + 'server-trust-ad sub-package of IPA on the server')) domain_validator = ipaserver.dcerpc.DomainValidator(self.api) if not domain_validator.is_configured(): - raise errors.NotFound(name=_('AD Trust setup'), - reason=_('''Cannot perform join operation without own domain configured. - Make sure you have run ipa-adtrust-install on the IPA server first''')) + raise errors.NotFound(reason=_('Cannot perform join operation without own domain configured. ' + 'Make sure you have run ipa-adtrust-install on the IPA server first')) sids = [] failed_sids = [] for sid in options['ipaexternalmember']: