pykolab/setup

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Tue Apr 30 17:59:59 CEST 2013


 pykolab/setup/setup_mta.py |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 92bd5a5e546862e9aa3dde54e6b77a7c5cd00359
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue Apr 30 16:48:30 2013 +0100

    Only .insert() a setting that is not already .set(), but just so happens to hold a value of the equivalent of None (#1818)

diff --git a/pykolab/setup/setup_mta.py b/pykolab/setup/setup_mta.py
index 9cd428b..8b33ef2 100644
--- a/pykolab/setup/setup_mta.py
+++ b/pykolab/setup/setup_mta.py
@@ -272,9 +272,12 @@ result_format = shared+%%s
         current_value = myaugeas.get(setting)
 
         if current_value == None:
-            insert_paths = myaugeas.match('/files/etc/postfix/main.cf/*')
-            insert_path = insert_paths[(len(insert_paths)-1)]
-            myaugeas.insert(insert_path, setting_key, False)
+            try:
+                myaugeas.set(setting, postfix_main_settings[setting_key])
+            except:
+                insert_paths = myaugeas.match('/files/etc/postfix/main.cf/*')
+                insert_path = insert_paths[(len(insert_paths)-1)]
+                myaugeas.insert(insert_path, setting_key, False)
 
         log.debug(_("Setting key %r to %r") % (setting_key, postfix_main_settings[setting_key]), level=8)
         myaugeas.set(setting, postfix_main_settings[setting_key])





More information about the commits mailing list