[Freeipa-devel] [PATCH] 0075 Fix error messages and use proper ImportError for dcerpc
Alexander Bokovoy
abokovoy at redhat.com
Thu Sep 20 12:01:07 UTC 2012
Hi,
fix use of NotFound error exception in plugins/group.py similar to what
is discussed in patch 0074 for idrange plugin.
--
/ Alexander Bokovoy
-------------- next part --------------
>From 9028d2c8c8da9bc259e00250093352085317f91c Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <abokovoy at redhat.com>
Date: Thu, 20 Sep 2012 14:02:15 +0300
Subject: [PATCH 2/4] 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 011587206d809cf7ab32308f8d70eba06298c555..ae00aa8ac7d087befa5107df4eb978f1ada00240 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']:
--
1.7.12
More information about the Freeipa-devel
mailing list