From 19fd3596225d7ca15b88f53451b94f9ffafd5a73 Mon Sep 17 00:00:00 2001 From: Jan Vcelak Date: Mon, 5 Oct 2009 18:11:12 +0200 Subject: [PATCH] tuned.py: automatically add section "main" into configuration when it is missing in config-file --- tuned.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tuned.py b/tuned.py index 58728cc..d5abef3 100644 --- a/tuned.py +++ b/tuned.py @@ -40,6 +40,10 @@ class Tuned: def init(self, path, cfgfile): self.config = ConfigParser.RawConfigParser() self.config.read(cfgfile) + + if not self.config.has_section("main"): + self.config.add_section("main") + if self.config.has_option("main", "interval"): self.interval = self.config.getint("main", "interval") else: