summaryrefslogtreecommitdiff
path: root/vymgmt/mgmt_common.py
diff options
context:
space:
mode:
Diffstat (limited to 'vymgmt/mgmt_common.py')
-rw-r--r--vymgmt/mgmt_common.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/vymgmt/mgmt_common.py b/vymgmt/mgmt_common.py
index 0ed4bf0..1ccb96a 100644
--- a/vymgmt/mgmt_common.py
+++ b/vymgmt/mgmt_common.py
@@ -17,3 +17,21 @@ def messenger(obj, config):
return "Result : Configured successfully"
except Exception as e:
return e
+
+
+def committer(obj, config):
+ """This method used for sending commit task to VyOS
+
+ :param obj: A connection object
+ :param config: A configuration string
+ :return: A message or an error
+ """
+ try:
+ obj.sendline(config)
+ obj.prompt()
+ if len(obj.before) > obj.before.index('\r\n') + 2:
+ return obj.before
+ else:
+ return "Result : Commit successfully"
+ except Exception as e:
+ return e