summaryrefslogtreecommitdiff
path: root/src/services/api/graphql/recipes/recipe.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2021-11-14 19:03:25 -0600
committerJohn Estabrook <jestabro@vyos.io>2021-11-15 14:50:28 -0600
commit8915a19f7761253b7bdf6ca847069539ee33851d (patch)
tree7e30fcb40c7e103de23a056b3bc5dc3d1d7e804f /src/services/api/graphql/recipes/recipe.py
parent9e2694b24b06d928240522322c9a6d60c7a7d290 (diff)
downloadvyos-1x-8915a19f7761253b7bdf6ca847069539ee33851d.tar.gz
vyos-1x-8915a19f7761253b7bdf6ca847069539ee33851d.zip
graphql: T3993: add config file save/load
Diffstat (limited to 'src/services/api/graphql/recipes/recipe.py')
-rw-r--r--src/services/api/graphql/recipes/recipe.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/services/api/graphql/recipes/recipe.py b/src/services/api/graphql/recipes/recipe.py
index 8fbb9e0bf..91d8bd67a 100644
--- a/src/services/api/graphql/recipes/recipe.py
+++ b/src/services/api/graphql/recipes/recipe.py
@@ -46,4 +46,23 @@ class Recipe(object):
except Exception as error:
raise error
+ def save(self):
+ session = self._session
+ data = self.data
+ if 'file_name' not in data or not data['file_name']:
+ data['file_name'] = '/config/config.boot'
+ try:
+ session.save_config(data['file_name'])
+ except Exception as error:
+ raise error
+
+ def load(self):
+ session = self._session
+ data = self.data
+
+ try:
+ session.load_config(data['file_name'])
+ session.commit()
+ except Exception as error:
+ raise error