Checks file existing before opening by parser

pull/52/head
buglloc 2017-05-19 19:24:30 +03:00
parent 2ea357ea7b
commit c5c8e6bdde
1 changed files with 6 additions and 3 deletions

View File

@ -110,14 +110,17 @@ class NginxParser(object):
def _resolve_file_include(self, pattern, parent):
path = os.path.join(self.cwd, pattern)
file_path = None
exists = False
for file_path in glob.iglob(path):
if not os.path.exists(file_path):
continue
exists = True
include = block.IncludeBlock('include', [file_path])
parent.append(include)
self.parse_file(file_path, include)
if not file_path:
LOG.warning("File not found: {0}".format(path))
if not exists:
LOG.warning('File not found: {0}'.format(path))
def _resolve_dump_include(self, pattern, parent):
path = os.path.join(self.cwd, pattern)