Changeset 784


Ignore:
Timestamp:
04/04/13 16:01:03 (11 years ago)
Author:
ramonb
Message:
  • more error checking if the config file exists and is readable
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/0.4/jobmond/jobmond.py

    r728 r784  
    2626
    2727import sys, getopt, ConfigParser, time, os, socket, string, re
    28 import xdrlib, socket, syslog, xml, xml.sax, shlex
     28import xdrlib, socket, syslog, xml, xml.sax, shlex, os.path
    2929from xml.sax.handler import feature_namespaces
    3030from collections import deque
     
    473473
    474474        return my_list
     475
     476    if not os.path.isfile( JOBMOND_CONF ):
     477
     478        print "Is not a file or does not exist: '%s'" %JOBMOND_CONF
     479        sys.exit( 1 )
     480
     481    try:
     482        f = open( JOBMOND_CONF, 'r' )
     483    except IOError, detail:
     484        print "Cannot read config file: '%s'" %JOBMOND_CONF
     485        sys.exit( 1 )
     486    else:
     487        f.close()
    475488
    476489    cfg        = ConfigParser.ConfigParser()
Note: See TracChangeset for help on using the changeset viewer.