fix KeyError 'plugin_dir' in conf.create
authorGui Chen <gui.chen@intel.com>
Mon, 25 Nov 2013 05:41:15 +0000 (00:41 -0500)
committerGui Chen <gui.chen@intel.com>
Fri, 29 Nov 2013 05:54:23 +0000 (00:54 -0500)
Change-Id: Ic4ad13938a43540cd934f2b2c48c65433b9b1049
Signed-off-by: Gui Chen <gui.chen@intel.com>
mic/conf.py

index 20dc75a..400829f 100644 (file)
@@ -128,11 +128,21 @@ class ConfigMgr(object):
     _ksconf = property(__get_ksconf, __set_ksconf)
 
     def _parse_siteconf(self, siteconf):
+
+        if os.getenv("MIC_PLUGIN_DIR"):
+            self.common["plugin_dir"] = os.environ["MIC_PLUGIN_DIR"]
+
+        if siteconf and not os.path.exists(siteconf):
+            msger.warning("cannot find config file: %s" % siteconf)
+            siteconf = None
+
         if not siteconf:
-            return
+            self.common["distro_name"] = "Tizen"
+            # append common section items to other sections
+            for section in self.DEFAULTS.keys():
+                if section != "common":
+                    getattr(self, section).update(self.common)
 
-        if not os.path.exists(siteconf):
-            msger.warning("cannot read config file: %s" % siteconf)
             return
 
         parser = ConfigParser.SafeConfigParser()
@@ -142,9 +152,6 @@ class ConfigMgr(object):
             if section in self.DEFAULTS:
                 getattr(self, section).update(dict(parser.items(section)))
 
-        if os.getenv("MIC_PLUGIN_DIR"):
-            self.common["plugin_dir"] = os.environ["MIC_PLUGIN_DIR"]
-
         # append common section items to other sections
         for section in self.DEFAULTS.keys():
             if section != "common":