Closed sdwilsh closed 3 years ago
I would have expected this line to match this and remove it, but that doesn't actually seem to be working.
This is maybe an encoding issue:
$ python3
Python 3.8.5 (default, Jan 27 2021, 15:41:15)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> r = re.compile(br"\x1b\[(\d+(;\d+)*)?m")
>>> r.search("\u001b[m".encode("cp1252"))
<re.Match object; span=(0, 3), match=b'\x1b[m'>
>>> r.search("\u001b[m")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: cannot use a bytes pattern on a string-like object
>>> r.search(b"\u001b[m")
>>>
I'm also able to reproduce this on 1.4-rolling-202103210217
Apparently the Ubuntu distribution of ansible 2.9 included vyos.vyos
, but a rather old version, so the collection that I had installed wasn't actually being used. It didn't have the regex that I expected to match this, and that's why it was not working.
SUMMARY
This looks similar to #65. I'm getting
\u001b[m
after every line or value when runningvyos.vyos.vyos_facts
, and this appears to break other things as well (I first came across this with an error when runningvyos.vyos.vyos_firewall_rules
and then proceeded to find a smaller test case to reproduce it with).For example:
ISSUE TYPE
COMPONENT NAME
vyos.vyos.vyos_facts
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Custom built vyos roughly equivalent to 1.3.0 RC1 (Build Commit ID: 3be456b18cf3ae)
STEPS TO REPRODUCE
ansible-playbook -i testing-inventory -l maccabeus.hogs.tswn.us get_facts.yml -u ansible -vvvv
EXPECTED RESULTS
ACTUAL RESULTS