configuration file not found

Joel Andres Granados jgranado at redhat.com
Thu Apr 12 16:33:51 UTC 2007


Hi list: Its me again.

Bug (I think): Pungi fails with a traceback when the config file is not 
correctly specified.  It says
      It does not find the default section.  
Reason: Its a config parser error.  The ConfigParser reads the existing 
files and ingnores the
        not existing ones.  In any case if the file does not exist or if 
it exists but there is no "default"
        section, pungi will fail with a traceback.

IMO catching the mistake before the traceback and telling the user what 
is happening is the right thing to do.
I don't know about the message though.  Its the best thing that my 
little mind could come up with :)

The diff:

@@ -37,7 +37,10 @@
 
     config = SafeConfigParser()
     config.read(opts.config)
-
+    if "default" not in config.sections():
+        print ("Check that the file %s exists and that "
+              "has a 'default' section" % opts.config)
+        exit(0)
     if not config.has_option('default', 'flavor'):
         config.set('default', 'flavor', flavor)
 




More information about the buildsys mailing list