allow decode empty passwd in conf to avoid exceptions
authorZhang Qiang <qiang.z.zhang@intel.com>
Fri, 8 Jun 2012 04:39:09 +0000 (12:39 +0800)
committerZhang Qiang <qiang.z.zhang@intel.com>
Fri, 8 Jun 2012 04:42:00 +0000 (12:42 +0800)
only check password if config file exist

gitbuildsys/conf.py

index f470539a102ea6b3b1878fa84f9db759c54f96fb..15a5a66b46afea66b1f22f5bfdc236a6c9673c7d 100644 (file)
@@ -292,10 +292,11 @@ commit_email = $import__commit_email
                 if not self._new_conf():
                     msger.error('No config file available')
 
-        self.cfgparser.read(fpaths)
-
         self.replaced_keys = defaultdict(list)
-        self._check_passwd()
+
+        if fpaths:
+            self.cfgparser.read(fpaths)
+            self._check_passwd()
 
     def _lookfor_confs(self):
         """Look for available config files following the order:
@@ -357,10 +358,9 @@ commit_email = $import__commit_email
             for key in self.options(sec):
                 if key.endswith('passwd'):
                     plainpass = self._get(key, sec)
-                    if not plainpass:
-                        # None or ''
+                    if plainpass is None:
                         continue
-
+                    # empty string password is acceptable here
                     self.replaced_keys[sec].append(key)
                     self.set(key,
                              base64.b64encode(plainpass.encode('bz2')),