Clean up pyflakes warnings in inventory

This commit is contained in:
Toshio Kuratomi 2015-10-19 11:13:56 -07:00
parent 63add130d4
commit a17ae6f07e
3 changed files with 5 additions and 7 deletions

View file

@ -23,7 +23,6 @@ import fnmatch
import os
import sys
import re
import stat
import itertools
from ansible.compat.six import string_types
@ -134,7 +133,7 @@ class Inventory(object):
return re.search(pattern_str[1:], str)
else:
return fnmatch.fnmatch(str, pattern_str)
except Exception as e:
except Exception:
raise AnsibleError('invalid host pattern: %s' % pattern_str)
def _match_list(self, items, item_attr, pattern_str):
@ -144,7 +143,7 @@ class Inventory(object):
pattern = re.compile(fnmatch.translate(pattern_str))
else:
pattern = re.compile(pattern_str[1:])
except Exception as e:
except Exception:
raise AnsibleError('invalid host pattern: %s' % pattern_str)
for item in items:
@ -397,7 +396,6 @@ class Inventory(object):
"""
results = []
hosts = []
hostnames = set()
def __append_host_to_results(host):

View file

@ -23,7 +23,7 @@ import ast
import re
from ansible import constants as C
from ansible.errors import *
from ansible.errors import AnsibleError
from ansible.inventory.host import Host
from ansible.inventory.group import Group
from ansible.inventory.expand_hosts import detect_range
@ -231,7 +231,7 @@ class InventoryParser(object):
try:
tokens = shlex_split(line, comments=True)
except ValueError as e:
self._raise_error("Error parsing host definition '%s': %s" % (varstring, e))
self._raise_error("Error parsing host definition '%s': %s" % (line, e))
(hostnames, port) = self._expand_hostpattern(tokens[0])
hosts = self._Hosts(hostnames, port)

View file

@ -27,7 +27,7 @@ from collections import Mapping
from ansible.compat.six import iteritems
from ansible import constants as C
from ansible.errors import *
from ansible.errors import AnsibleError
from ansible.inventory.host import Host
from ansible.inventory.group import Group
from ansible.module_utils.basic import json_dict_bytes_to_unicode