When using vymgmt the following sequence of command works as expected when executed on a fresh connection
config = vyos.run_op_mode_command("echo 'START PRINT'; cat /config/config.boot; echo 'END PRINT'") config = config.replace("\r", "") match = re.search(r"[^\n]+\nSTART PRINT\n(.*)END PRINT\n", config, re.DOTALL) # matches all config
However, when first going to configure mode, it breaks
vyos.configure() vyos.save() vyos.exit() config = vyos.run_op_mode_command("echo 'START PRINT'; cat /config/config.boot; echo 'END PRINT'") config = config.replace("\r", "") match = re.search(r"[^\n]+\nSTART PRINT\n(.*)END PRINT\n", config, re.DOTALL) # no match, config is truncated after encrypted-password
The reason is https://github.com/vyos/python-vyos-mgmt/blob/c1f8661a4cf7ce52c55e5bc43008f9305790a72e/vymgmt/router.py#L195
Here, the unique prompt used to break off reading is replaced with "$"
However, "$" can occur in the config
For example:
encrypted-password $1$HR4....
This means that the library no longer responds in a consistent way.
It would be good to at least document this known issue more clearly.