File 0001-Fixed-device.commit-with-vdoms.patch of Package python-pyfg
From 2b5bec824cdea268b8abd25c6b5efd034f215ff3 Mon Sep 17 00:00:00 2001
From: awlx <awlnx@penguinfriends.org>
Date: Thu, 17 Aug 2017 13:55:29 +0200
Subject: [PATCH] Fixed device.commit() with vdoms
---
pyFG/fortios.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/pyFG/fortios.py b/pyFG/fortios.py
index f5ea250..23feef6 100644
--- a/pyFG/fortios.py
+++ b/pyFG/fortios.py
@@ -285,12 +285,18 @@ class FortiOS(object):
if config_text is None:
config_text = self.compare_config()
+ config_vdom = ""
+
if self.vdom is None:
pre = ''
+ elif not 'global' in self.vdom:
+ config_vdom = 'conf vdom\n edit %s\n' % self.vdom
+ pre = 'conf global\n '
else:
pre = 'conf global\n '
cmd = '%sexecute batch start\n' % pre
+ cmd += config_vdom
cmd += config_text
cmd += '\nexecute batch end\n'
--
2.23.0