Skip to content

Commit b0cf212

Browse files
committed
code enhancement
Signed-off-by: Chin Yeung Li <[email protected]>
1 parent 7c5879f commit b0cf212

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/attributecode/cmd.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,13 @@ def attrib(location, output, template, mapping, inventory, quiet, show_all,
323323
use_mapping=mapping, template_loc=template,
324324
inventory_location=inventory)
325325

326-
# Check for template error
327-
with open(output, 'r') as output_file:
328-
first_line = output_file.readline()
329-
if first_line.startswith('Template processing error'):
330-
click.echo(first_line)
331-
sys.exit(errno.ENOEXEC)
326+
if not no_match_errors:
327+
# Check for template error
328+
with open(output, 'r') as output_file:
329+
first_line = output_file.readline()
330+
if first_line.startswith('Template processing error'):
331+
click.echo(first_line)
332+
sys.exit(errno.ENOEXEC)
332333

333334
for no_match_error in no_match_errors:
334335
inv_errors.append(no_match_error)

0 commit comments

Comments
 (0)