files = []
     dir = "/etc/planetlab/db-config.d"
     try:
-        files = os.listdir(dir)
+        if os.path.exits(dir):
+            files = os.listdir(dir)
     except:
         pass
 
+    ignored = (".bak","~",".rpmsave",".rpmnew",".orig")
     for file in files:
-        if (file.endswith(".bak") or file.endswith("~") or
-            file.endswith(".rpmsave") or file.endswith(".rpmnew") or
-            file.endswith(".orig")):
-            continue
+        for ignore in ignored:
+            if file.endswith(ignore): continue
         execfile(os.path.join(dir, file))
 
-
 if __name__ == '__main__':
     main()