mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Added user friendly error message for dnszone enable and disable
Added try-except block in dns plugin in order to provide user friendly message to end user. https://fedorahosted.org/freeipa/ticket/4811 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
parent
82fd4250b9
commit
c60cec4fa7
@ -2231,7 +2231,11 @@ class DNSZoneBase_disable(LDAPQuery):
|
|||||||
ldap = self.obj.backend
|
ldap = self.obj.backend
|
||||||
|
|
||||||
dn = self.obj.get_dn(*keys, **options)
|
dn = self.obj.get_dn(*keys, **options)
|
||||||
entry = ldap.get_entry(dn, ['idnszoneactive', 'objectclass'])
|
try:
|
||||||
|
entry = ldap.get_entry(dn, ['idnszoneactive', 'objectclass'])
|
||||||
|
except errors.NotFound:
|
||||||
|
self.obj.handle_not_found(*keys)
|
||||||
|
|
||||||
if not _check_entry_objectclass(entry, self.obj.object_class):
|
if not _check_entry_objectclass(entry, self.obj.object_class):
|
||||||
self.obj.handle_not_found(*keys)
|
self.obj.handle_not_found(*keys)
|
||||||
|
|
||||||
@ -2252,7 +2256,11 @@ class DNSZoneBase_enable(LDAPQuery):
|
|||||||
ldap = self.obj.backend
|
ldap = self.obj.backend
|
||||||
|
|
||||||
dn = self.obj.get_dn(*keys, **options)
|
dn = self.obj.get_dn(*keys, **options)
|
||||||
entry = ldap.get_entry(dn, ['idnszoneactive', 'objectclass'])
|
try:
|
||||||
|
entry = ldap.get_entry(dn, ['idnszoneactive', 'objectclass'])
|
||||||
|
except errors.NotFound:
|
||||||
|
self.obj.handle_not_found(*keys)
|
||||||
|
|
||||||
if not _check_entry_objectclass(entry, self.obj.object_class):
|
if not _check_entry_objectclass(entry, self.obj.object_class):
|
||||||
self.obj.handle_not_found(*keys)
|
self.obj.handle_not_found(*keys)
|
||||||
|
|
||||||
|
@ -4319,7 +4319,9 @@ class test_forward_zones(Declarative):
|
|||||||
dict(
|
dict(
|
||||||
desc='Try to disable non-existent forward zone',
|
desc='Try to disable non-existent forward zone',
|
||||||
command=('dnsforwardzone_disable', [nonexistent_fwzone], {}),
|
command=('dnsforwardzone_disable', [nonexistent_fwzone], {}),
|
||||||
expected=errors.NotFound(reason="no such entry")
|
expected=errors.NotFound(
|
||||||
|
reason=u'%s: DNS forward zone not found' % nonexistent_fwzone
|
||||||
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
||||||
@ -4364,7 +4366,9 @@ class test_forward_zones(Declarative):
|
|||||||
dict(
|
dict(
|
||||||
desc='Try to enable non-existent forward zone',
|
desc='Try to enable non-existent forward zone',
|
||||||
command=('dnsforwardzone_enable', [nonexistent_fwzone], {}),
|
command=('dnsforwardzone_enable', [nonexistent_fwzone], {}),
|
||||||
expected=errors.NotFound(reason="no such entry")
|
expected=errors.NotFound(
|
||||||
|
reason=u'%s: DNS forward zone not found' % nonexistent_fwzone
|
||||||
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user