diff options
| author | Petr Spacek <pspacek@redhat.com> | 2016-01-07 16:17:24 +0100 |
|---|---|---|
| committer | Martin Basti <mbasti@redhat.com> | 2016-01-08 10:14:51 +0100 |
| commit | 17a4a29c251797261d91e3ec25aedfd985dbd238 (patch) | |
| tree | 69152d5d68c778e3ab260d6181faea04d5c196aa | |
| parent | aab190cc5d38edf3f4fbf0a6c12911dfc8f37fd3 (diff) | |
Fix dns_is_enabled() API command to throw exceptions as appropriate
Previously the command returned False whenever an exception occured
which caused installed to continue even when there was a problem with
LDAP connection.
https://fedorahosted.org/freeipa/ticket/5564
Reviewed-By: David Kupka <dkupka@redhat.com>
| -rw-r--r-- | ipalib/plugins/dns.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py index d5448c879..59cb0ea39 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -4266,16 +4266,14 @@ class dns_is_enabled(Command): dns_enabled = False try: - ent = ldap.find_entries(filter=self.filter, base_dn=self.base_dn) - if len(ent): - dns_enabled = True - except Exception as e: - pass + ldap.find_entries(filter=self.filter, base_dn=self.base_dn) + dns_enabled = True + except errors.EmptyResult: + dns_enabled = False return dict(result=dns_enabled, value=pkey_to_value(None, options)) - @register() class dnsconfig(LDAPObject): """ |
