Fix pylint 2.0 conditional-related violations

In order to support pylint 2.0 the following violations must be fixed:

- `chained-comparison` (R1716):
  Simplify chained comparison between the operands This message is
  emitted when pylint encounters boolean operation like
  "a < b and b < c", suggesting instead to refactor it to "a < b < c".

- `consider-using-in` (R1714):
  Consider merging these comparisons with "in" to %r To check if a
  variable is equal to one of many values,combine the values into a
  tuple and check if the variable is contained "in" it instead of
  checking for equality against each of the values.This is faster
  and less verbose.

Issue: https://pagure.io/freeipa/issue/7614

Signed-off-by: Armando Neto <abiagion@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
Armando Neto
2018-07-11 17:30:12 -03:00
committed by Christian Heimes
parent f48f00c692
commit ba954efafd
9 changed files with 12 additions and 12 deletions

View File

@@ -209,7 +209,7 @@ def verify_fqdn(host_name, no_host_dns=False, local_hostname=True):
address = a[4][0]
if address in verified:
continue
if address == '127.0.0.1' or address == '::1':
if address in ('127.0.0.1', '::1'):
raise HostForwardLookupError("The IPA Server hostname must not resolve to localhost (%s). A routable IP address must be used. Check /etc/hosts to see if %s is an alias for %s" % (address, host_name, address))
try:
logger.debug('Check reverse address of %s', address)