This task deals with a "small" design concept about adding a library for accessing the running configuration from operational level.
By the time of this writing, every time I was facing the issue - to query the current configuration if I can execute an op-mode command or not, I found myself in ending up with a bash script calling cli-shell-api and then mangle the results.
"bad" example:
bash if cli-shell-api existsActive service ssh; then sudo systemctl restart ssh.service else echo "Service SSH not configured" fi
As time progresses and we might have more complex op-mode scripts we should provide a programming library in Python which at the very least supports:
- check if a cli node is available or not similar to vyos.config.Config.exists()
- return the value(s) of CLI nodes and multi-nodes same as vyos.config.Config.exists()
- execute arbitrary "other" op-mode commands, like "renew dhcp interface eth0"