-
Notifications
You must be signed in to change notification settings - Fork 100
Description
Hey @kevinsteves - thanks for this lib.
The actual CLI on devices does not produce valid output if users have newlines, quotes, etc in their descriptions, etc. So we recommend our Batfish users to use Panconf to fetch XML and then convert it to SET via panconf: https://pybatfish.readthedocs.io/en/latest/formats.html#from-panorama-preferred
We're running into an issue where XML nodes that contain complicated text (like JSON) make output files that are unparseable. Panconf is better than the device CLI, but it has similar issues. I think the culprit is this code:
Lines 257 to 263 in 0ad1c02
def __quote_arg(self, s): | |
# XXX string with " etc. | |
if '"' in s: | |
return "'%s'" % s | |
if ' ' in s: | |
return '"%s"' % s | |
return s |
It clearly will do the wrong thing on, e.g., a cell that contains only '"
(single-quote double-quote) -- it will output ''"'
(single/single/double/single) which is still not a valid string (three single-quotes).
Is this desired behavior for some reason? If not, would you be open to a PR that does some escaping to produce parseable output? Do you have an opinion for how that output should look?
Thanks!