-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Description
What happened?
On certain Arista EOS versions, using the pipe syntax (| json) in CLI commands executed via net.cli fails with a JSON parsing error. The NAPALM EOS driver (which uses pyeapi) requires the encoding parameter to be passed explicitly to return JSON-formatted output, but the current net.cli function provides no way to pass this driver-specific option.
When running : salt <minion> net.cli "show version | json"
this does not return json data on some EOS versions, which then stack traces when we try to json.load the return.
The pyeapi library supports an encoding parameter in its cli() method that instructs the eAPI to return output in a specific format (e.g., json or text). However, Salt's net.cli function did not provide a mechanism to pass this parameter through to the underlying NAPALM driver.
Type of salt install
Official deb
Major version
3006.x
What supported OS are you seeing the problem on? Can select multiple. (If bug appears on an unsupported OS, please open a GitHub Discussion instead)
ubuntu-22.04
salt --versions-report output
3006.9