summaryrefslogtreecommitdiff
path: root/python/vyos
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2019-08-05 21:20:54 +0200
committerDaniil Baturin <daniil@baturin.org>2019-08-05 21:20:54 +0200
commit9ac783472872329fe1a1683585b679a7afcc78f0 (patch)
tree9e04b2d799d81a34bffedcaa1e5e487e07a80191 /python/vyos
parentb4ed7280179e814b9837a0fbfa05ff8065dd8b50 (diff)
downloadvyos-1x-9ac783472872329fe1a1683585b679a7afcc78f0.tar.gz
vyos-1x-9ac783472872329fe1a1683585b679a7afcc78f0.zip
T1431: add showConfig operation to the HTTP API.
Diffstat (limited to 'python/vyos')
-rw-r--r--python/vyos/configsession.py8
1 files changed, 8 insertions, 0 deletions
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
+