Added another guard against varying pyang output format.
- Legacy-Id: 10966
This commit is contained in:
parent
f52e21fb17
commit
7b65e2624f
|
@ -142,17 +142,21 @@ class DraftYangChecker(object):
|
||||||
if code > 0:
|
if code > 0:
|
||||||
error_lines = err.splitlines()
|
error_lines = err.splitlines()
|
||||||
for line in error_lines:
|
for line in error_lines:
|
||||||
fn, lnum, msg = line.split(':', 2)
|
if line.strip():
|
||||||
lnum = int(lnum)
|
try:
|
||||||
if fn == model and (lnum-1) in range(len(text)):
|
fn, lnum, msg = line.split(':', 2)
|
||||||
line = text[lnum-1].rstrip()
|
lnum = int(lnum)
|
||||||
else:
|
if fn == model and (lnum-1) in range(len(text)):
|
||||||
line = None
|
line = text[lnum-1].rstrip()
|
||||||
items.append((lnum, line, msg))
|
else:
|
||||||
if 'error: ' in msg:
|
line = None
|
||||||
errors += 1
|
items.append((lnum, line, msg))
|
||||||
if 'warning: ' in msg:
|
if 'error: ' in msg:
|
||||||
warnings += 1
|
errors += 1
|
||||||
|
if 'warning: ' in msg:
|
||||||
|
warnings += 1
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
results[model] = {
|
results[model] = {
|
||||||
"passed": code == 0,
|
"passed": code == 0,
|
||||||
"message": out+"No validation errors\n" if code == 0 else err,
|
"message": out+"No validation errors\n" if code == 0 else err,
|
||||||
|
|
Loading…
Reference in a new issue