From 9ac783472872329fe1a1683585b679a7afcc78f0 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Mon, 5 Aug 2019 21:20:54 +0200 Subject: T1431: add showConfig operation to the HTTP API. --- python/vyos/configsession.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'python/vyos') diff --git a/python/vyos/configsession.py b/python/vyos/configsession.py index 1a8077edd..8626839f2 100644 --- a/python/vyos/configsession.py +++ b/python/vyos/configsession.py @@ -23,6 +23,7 @@ DELETE = '/opt/vyatta/sbin/my_delete' COMMENT = '/opt/vyatta/sbin/my_comment' COMMIT = '/opt/vyatta/sbin/my_commit' DISCARD = '/opt/vyatta/sbin/my_discard' +SHOW_CONFIG = ['/bin/cli-shell-api', 'showConfig'] # Default "commit via" string APP = "vyos-http-api" @@ -147,3 +148,10 @@ class ConfigSession(object): def discard(self): self.__run_command([DISCARD]) + + def show_config(self, path, format='raw'): + config_data = self.__run_command(SHOW_CONFIG + path) + + if format == 'raw': + return config_data + -- cgit v1.2.3