Пример #1
0
def main():
    '''
    Parse command line arguments, do initial setup, then initiate 
    parsing process.
    '''
    install_exc_handler(default_handler)

    ver = "APEL parser %s.%s.%s" % __version__
    opt_parser = OptionParser(description=__doc__, version=ver)
    opt_parser.add_option("-c",
                          "--config",
                          help="location of config file",
                          default="/etc/apel/parser.cfg")
    opt_parser.add_option("-l",
                          "--log_config",
                          help="location of logging config file (optional)",
                          default="/etc/apel/parserlog.cfg")
    options, unused_args = opt_parser.parse_args()

    # Read configuration from file
    try:
        cp = ConfigParser.ConfigParser()
        cp.read(options.config)
    except Exception, e:
        sys.stderr.write(str(e))
        sys.stderr.write('\n')
        sys.exit(1)
Пример #2
0
def main():
    
    install_exc_handler(default_handler)
    ver = 'APEL client %s.%s.%s' % __version__
    opt_parser = OptionParser(version=ver, description=__doc__)
    
    opt_parser.add_option('-c', '--config',
                          help='main configuration file for APEL',
                          default='/etc/apel/client.cfg')
    
    opt_parser.add_option('-s', '--ssm_config', 
                          help='location of SSM config file',
                          default='/etc/apel/sender.cfg')
    
    opt_parser.add_option('-l', '--log_config', 
                          help='location of logging config file (optional)',
                          default='/etc/apel/logging.cfg')
    
    options, unused_args = opt_parser.parse_args()
    cp = ConfigParser.ConfigParser()
    cp.read(options.config)

    # set up logging
    try:
        if os.path.exists(options.log_config):
            logging.config.fileConfig(options.log_config)
        else:
            set_up_logging(cp.get('logging', 'logfile'), 
                           cp.get('logging', 'level'),
                           cp.getboolean('logging', 'console'))
        log = logging.getLogger('client')
    except (ConfigParser.Error, ValueError, IOError), err:
        print 'Error configuring logging: %s' % str(err)
        print 'The system will exit.'
        sys.exit(1)
Пример #3
0
def main():
    '''
    Parse command line arguments, set up logging and begin the client
    workflow.
    '''
    install_exc_handler(default_handler)
    ver = 'APEL client %s.%s.%s' % __version__
    opt_parser = OptionParser(version=ver, description=__doc__)

    opt_parser.add_option('-c',
                          '--config',
                          help='main configuration file for APEL',
                          default='/etc/apel/client.cfg')

    opt_parser.add_option('-s',
                          '--ssm_config',
                          help='location of SSM config file',
                          default='/etc/apel/sender.cfg')

    opt_parser.add_option('-l',
                          '--log_config',
                          help='location of logging config file (optional)',
                          default='/etc/apel/logging.cfg')

    options, unused_args = opt_parser.parse_args()
    ccp = ConfigParser.ConfigParser()
    ccp.read(options.config)

    scp = ConfigParser.ConfigParser()
    scp.read(options.ssm_config)

    # set up logging
    try:
        if os.path.exists(options.log_config):
            logging.config.fileConfig(options.log_config)
        else:
            set_up_logging(ccp.get('logging', 'logfile'),
                           ccp.get('logging', 'level'),
                           ccp.getboolean('logging', 'console'))
        log = logging.getLogger(LOGGER_ID)
    except (ConfigParser.Error, ValueError, IOError), err:
        print 'Error configuring logging: %s' % str(err)
        print 'The system will exit.'
        sys.exit(1)
Пример #4
0
def main():
    '''
    Parse command line arguments, do initial setup, then initiate 
    parsing process.
    '''
    install_exc_handler(default_handler)
    
    ver = "APEL parser %s.%s.%s" % __version__
    opt_parser = OptionParser(description=__doc__, version=ver)
    opt_parser.add_option("-c", "--config", help="location of config file", 
                          default="/etc/apel/parser.cfg")
    opt_parser.add_option("-l", "--log_config", help="location of logging config file (optional)", 
                          default="/etc/apel/parserlog.cfg")
    options, unused_args = opt_parser.parse_args()
    
    # Read configuration from file 
    try:
        cp = ConfigParser.ConfigParser()
        cp.read(options.config) 
    except Exception, e:
        sys.stderr.write(str(e))
        sys.stderr.write('\n')
        sys.exit(1)
Пример #5
0
def main():
    """
    Parse command line arguments, set up logging and begin the client 
    workflow.
    """
    install_exc_handler(default_handler)
    ver = "APEL client %s.%s.%s" % __version__
    opt_parser = OptionParser(version=ver, description=__doc__)

    opt_parser.add_option("-c", "--config", help="main configuration file for APEL", default="/etc/apel/client.cfg")

    opt_parser.add_option("-s", "--ssm_config", help="location of SSM config file", default="/etc/apel/sender.cfg")

    opt_parser.add_option(
        "-l", "--log_config", help="location of logging config file (optional)", default="/etc/apel/logging.cfg"
    )

    options, unused_args = opt_parser.parse_args()
    ccp = ConfigParser.ConfigParser()
    ccp.read(options.config)

    scp = ConfigParser.ConfigParser()
    scp.read(options.ssm_config)

    # set up logging
    try:
        if os.path.exists(options.log_config):
            logging.config.fileConfig(options.log_config)
        else:
            set_up_logging(
                ccp.get("logging", "logfile"), ccp.get("logging", "level"), ccp.getboolean("logging", "console")
            )
        log = logging.getLogger(LOGGER_ID)
    except (ConfigParser.Error, ValueError, IOError), err:
        print "Error configuring logging: %s" % str(err)
        print "The system will exit."
        sys.exit(1)