summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-04-30 16:48:30 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-04-30 16:49:08 +0100
commit92bd5a5e546862e9aa3dde54e6b77a7c5cd00359 (patch)
tree9795bc6d8188335881b5c0a26a1294805b96e8de
parent42b4c46cbdff95c91b2db0410a20a630676467de (diff)
downloadpykolab-92bd5a5e546862e9aa3dde54e6b77a7c5cd00359.tar.gz
Only .insert() a setting that is not already .set(), but just so happens to hold a value of the equivalent of None (#1818)
-rw-r--r--pykolab/setup/setup_mta.py9
1 files changed, 6 insertions, 3 deletions
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])