LGTM: unnecessary else in for loop

for/else makes only sense when the for loop uses break, too. If the for
loop simply returns on success, then else is not necessary.

Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
This commit is contained in:
Christian Heimes
2018-01-04 13:51:39 +01:00
parent 5d02c6aaeb
commit beb6d74b81
4 changed files with 17 additions and 18 deletions

View File

@@ -3426,8 +3426,7 @@ class dnsrecord(LDAPObject):
time.sleep(period)
# Maximum number of attempts was reached
else:
raise errors.DNSDataMismatch(expected=ldap_rrset, got=dns_rrset)
raise errors.DNSDataMismatch(expected=ldap_rrset, got=dns_rrset)
def wait_for_modified_attrs(self, entry_attrs, dns_name, dns_domain):
'''Wait until DNS resolver returns up-to-date answer for given entry

View File

@@ -694,6 +694,7 @@ class permission(baseldap.LDAPObject):
acientry = ldap.get_entry(location, ['aci'])
except errors.NotFound:
acientry = ldap.make_entry(location)
acis = acientry.get('aci', ())
for acistring in acis:
try:
@@ -704,12 +705,12 @@ class permission(baseldap.LDAPObject):
continue
if aci.name == wanted_aciname:
return acientry, acistring
else:
if notfound_ok:
return acientry, None
raise errors.NotFound(
reason=_('The ACI for permission %(name)s was not found '
'in %(dn)s ') % {'name': name, 'dn': location})
if notfound_ok:
return acientry, None
raise errors.NotFound(
reason=_('The ACI for permission %(name)s was not found '
'in %(dn)s ') % {'name': name, 'dn': location})
def upgrade_permission(self, entry, target_entry=None,
output_only=False, cached_acientry=None):