def main(): global logger argv = sys.argv[1:] opts = parseArgs(argv) configLogging(opts) logger.debug("Running %s with options %s" %(sys.argv[0], opts)) # The script will either run with a config file or with the -p or -k option # The -c option takes precedent so start with that checkForConfig = True if opts.configfile : # If you have specified the configfile then -p and -k will be ignored if opts.prkey or opts.prcertkey : logger.warn("You have specified an omni config file location; the -p"+\ " and -k options are going to be ignored.") opts.prkey = None opts.prcertkey = None # If the user provided the location of a private key for the cert start from # remove the passphrase if opts.prcertkey : opts.prcertkey= os.path.expanduser(opts.prcertkey) removeSSLPassphrase(opts.prcertkey) checkForConfig = False if opts.prkey : opts.prkey= os.path.expanduser(opts.prkey) removeSSHPassphrase(opts.prkey) checkForConfig = False if checkForConfig : try: config = load_config(opts, logger) except OmniError, oe: sys.exit(-1) # Form config find the private key for the SSL cert prcertkey = config["selected_framework"]["key"] prcertkey= os.path.expanduser(prcertkey) removeSSLPassphrase(prcertkey) # Form config find all the private SSH keys stored in the user computer keylist = findSSHPrivKeys(config) logger.debug("List of private ssh keys: %s" %(str(keylist))) for key in keylist : key = os.path.expanduser(key) removeSSHPassphrase(key)
# First, suppress all but WARN+ messages on console if not options.debug: lvl = logging.INFO handlers = logger.handlers if len(handlers) == 0: handlers = logging.getLogger().handlers for handler in handlers: if isinstance(handler, logging.StreamHandler): lvl = handler.level handler.setLevel(logging.WARN) break config = omni.load_agg_nick_config(options, logger) # Load custom config _after_ system agg_nick_cache, # which also sets omni_defaults config = omni.load_config(options, logger, config) if config.has_key('omni_defaults') and config['omni_defaults'].has_key('scs_url'): if options.scsURL is not None: logger.debug("Ignoring omni_config default SCS URL of '%s' because commandline specified '%s'", config['omni_defaults']['scs_url'], options.scsURL) else: options.scsURL = config['omni_defaults']['scs_url'] logger.debug("Using SCS URL from omni_config: %s", options.scsURL) else: if options.scsURL is None: options.scsURL = SCS_URL logger.debug("Using SCS URL default: %s", SCS_URL) else: logger.debug("Using SCS URL from commandline: %s", options.scsURL) if not options.debug: handlers = logger.handlers
# First, suppress all but WARN+ messages on console if not options.debug: lvl = logging.INFO handlers = logger.handlers if len(handlers) == 0: handlers = logging.getLogger().handlers for handler in handlers: if isinstance(handler, logging.StreamHandler): lvl = handler.level handler.setLevel(logging.WARN) break config = omni.load_agg_nick_config(options, logger) # Load custom config _after_ system agg_nick_cache, # which also sets omni_defaults config = omni.load_config(options, logger, config) if config.has_key('omni_defaults') and config['omni_defaults'].has_key( 'scs_url'): if options.scsURL is not None: logger.debug( "Ignoring omni_config default SCS URL of '%s' because commandline specified '%s'", config['omni_defaults']['scs_url'], options.scsURL) else: options.scsURL = config['omni_defaults']['scs_url'] logger.debug("Using SCS URL from omni_config: %s", options.scsURL) else: if options.scsURL is None: options.scsURL = SCS_URL logger.debug("Using SCS URL default: %s", SCS_URL) else: logger.debug("Using SCS URL from commandline: %s", options.scsURL)