Skip to content

Commit 95a5400

Browse files
committed
Changed the handling of yang validation otput to capture errors messages also when command the exit code is zero.
- Legacy-Id: 14100
1 parent 25cc899 commit 95a5400

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

ietf/submit/checkers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def check_file_txt(self, path):
207207
cmd = cmd_template.format(libs=modpath, model=path)
208208
code, out, err = pipe(cmd)
209209
items = []
210-
if code > 0:
210+
if code > 0 or len(err.strip()) > 0 :
211211
error_lines = err.splitlines()
212212
for line in error_lines:
213213
if line.strip():
@@ -226,7 +226,7 @@ def check_file_txt(self, path):
226226
except ValueError:
227227
pass
228228
#passed = passed and code == 0 # For the submission tool. Yang checks always pass
229-
message += "%s: %s:\n%s\n" % (cmd_version, cmd_template, out+"No validation errors\n" if code == 0 else err)
229+
message += "%s: %s:\n%s\n" % (cmd_version, cmd_template, out+"No validation errors\n" if (code == 0 and len(err) == 0) else out+err)
230230

231231
# yanglint
232232
if settings.SUBMIT_YANGLINT_COMMAND:
@@ -235,7 +235,7 @@ def check_file_txt(self, path):
235235
cmd_version = VersionInfo.objects.get(command=command).version
236236
cmd = cmd_template.format(model=path, rfclib=settings.SUBMIT_YANG_RFC_MODEL_DIR, draftlib=settings.SUBMIT_YANG_DRAFT_MODEL_DIR, tmplib=workdir)
237237
code, out, err = pipe(cmd)
238-
if code > 0:
238+
if code > 0 or len(err.strip()) > 0:
239239
error_lines = err.splitlines()
240240
for line in error_lines:
241241
if line.strip():
@@ -247,7 +247,7 @@ def check_file_txt(self, path):
247247
except ValueError:
248248
pass
249249
#passed = passed and code == 0 # For the submission tool. Yang checks always pass
250-
message += "%s: %s:\n%s\n" % (cmd_version, cmd_template, out+"No validation errors\n" if code == 0 else err)
250+
message += "%s: %s:\n%s\n" % (cmd_version, cmd_template, out+"No validation errors\n" if (code == 0 and len(err) == 0) else out+err)
251251
else:
252252
errors += 1
253253
message += "No such file: %s\nPossible mismatch between extracted xym file name and returned module name?\n" % (path)

0 commit comments

Comments
 (0)