Page MenuHomeVyOS Platform

Implement config write API for Python
Closed, ResolvedPublicENHANCEMENT

Description

Right now we only have config read API for Python, and no write API. If used with care, it can be implemented by saving the environment variables given by cli-shell-api getSessionEnv and using it for calls to my_set, my_delete etc.

s = vyos.configsession.ConfigSession(os.getpid(), app="vyos-http-api")
s.set(["system", "host-name"], value="vyos")
s.delete(["system", "options", "reboot-on-panic"])
s.comment(["system", "host-name"], value="Haha, I can change host-name via an API")
s.commit()

Details

Version
-
Is it a breaking change?
Perfectly compatible

Event Timeline

syncer changed the subtype of this task from "Task" to "Enhancement".Mar 15 2020, 3:25 PM
dmbaturin edited a custom field.
dmbaturin edited a custom field.
dmbaturin set Is it a breaking change? to Perfectly compatible.