mirror of https://github.com/yandex/gixy
Checks file existing before opening by parser (#52)
parent
e477e02350
commit
9643318c93
|
@ -110,14 +110,17 @@ class NginxParser(object):
|
||||||
|
|
||||||
def _resolve_file_include(self, pattern, parent):
|
def _resolve_file_include(self, pattern, parent):
|
||||||
path = os.path.join(self.cwd, pattern)
|
path = os.path.join(self.cwd, pattern)
|
||||||
file_path = None
|
exists = False
|
||||||
for file_path in glob.iglob(path):
|
for file_path in glob.iglob(path):
|
||||||
|
if not os.path.exists(file_path):
|
||||||
|
continue
|
||||||
|
exists = True
|
||||||
include = block.IncludeBlock('include', [file_path])
|
include = block.IncludeBlock('include', [file_path])
|
||||||
parent.append(include)
|
parent.append(include)
|
||||||
self.parse_file(file_path, include)
|
self.parse_file(file_path, include)
|
||||||
|
|
||||||
if not file_path:
|
if not exists:
|
||||||
LOG.warning("File not found: {0}".format(path))
|
LOG.warning('File not found: {0}'.format(path))
|
||||||
|
|
||||||
def _resolve_dump_include(self, pattern, parent):
|
def _resolve_dump_include(self, pattern, parent):
|
||||||
path = os.path.join(self.cwd, pattern)
|
path = os.path.join(self.cwd, pattern)
|
||||||
|
|
Loading…
Reference in New Issue