Ejemplo n.º 1
0
    elif os.path.exists(options.kittens):
        result = open(options.kittens, 'r').readlines()

    elif ',' in options.kittens:
        result = options.kittens.split(',')
    else:
        result.append(options.kittens)

    return result


if __name__ == "__main__":
    options = initOptions(params=_defaultOptions)

    initLogs(options, chatty=False)

    if options.cachefile is None:
        options.cachefile = os.path.join(options.appPath, 'kittenherder_seen.dat')

    if options.kittens is None:
        log.info('kitten list not specified, defaulting to %s' % urlNeedingReboot)
        options.kittens = urlNeedingReboot

    if options.filter is not None:
        reFilter = re.compile(options.filterbase % options.filter)
    else:
        reFilter = None

    db = dbRedis(options)
Ejemplo n.º 2
0
    log.info('done')


_defaultOptions = { 'config':      ('-c', '--config',      None,  'Configuration file'),
                    'debug':       ('-d', '--debug',       True,  'Enable Debug', 'b'),
                    'background':  ('-b', '--background',  False, 'daemonize ourselves', 'b'),
                    'logpath':     ('-l', '--logpath',     None,  'Path where log file is to be written'),
                    'address':     ('',   '--address' ,    None,  'IP Address'),
                    'archivepath': ('',   '--archivepath', '.',   'Path where incoming jobs are to be archived'),
                    'redis':       ('-r', '--redis',      'localhost:6379', 'Redis connection string'),
                    'redisdb':     ('',   '--redisdb',    '8',              'Redis database'),
                  }

if __name__ == '__main__':
    options = initOptions(_defaultOptions)
    initLogs(options)

    log.info('Starting')

    if options.address is None:
        log.error('Address is a required parameter, exiting')
        sys.exit(2)

    db = dbRedis(options)

    log.info('Creating processes')
    Process(name='worker', target=worker, args=(jobQueue, metricQueue, db, options.archivepath)).start()
    Process(name='metric', target=metric, args=(metricQueue, options)).start()

    if ':' not in options.address:
        options.address = '%s:%s' % (options.address, PORT_PULSE)
Ejemplo n.º 3
0
    elif os.path.exists(options.kittens):
        result = open(options.kittens, 'r').readlines()

    elif ',' in options.kittens:
        result = options.kittens.split(',')
    else:
        result.append(options.kittens)

    return result


if __name__ == "__main__":
    options = initOptions(params=_defaultOptions)

    initLogs(options, chatty=False)

    if options.cachefile is None:
        options.cachefile = os.path.join(options.appPath,
                                         'kittenherder_seen.dat')

    if options.kittens is None:
        log.info('kitten list not specified, defaulting to %s' %
                 urlNeedingReboot)
        options.kittens = urlNeedingReboot

    if options.filter is not None:
        reFilter = re.compile(options.filterbase % options.filter)
    else:
        reFilter = None
Ejemplo n.º 4
0
    for host, weight in swtKittens[:10]:
        h.write(kTableDetail % kittens[host])
    h.write(kTableFooter)

    h.close()


_defaultOptions = {
    'config': ('-c', '--config', None, 'Configuration file'),
    'debug': ('-d', '--debug', True, 'Enable Debug', 'b'),
    'logpath':
    ('-l', '--logpath', None, 'Path where log file is to be written'),
    'redis': ('-r', '--redis', 'localhost:6379', 'Redis connection string'),
    'redisdb': ('', '--redisdb', '8', 'Redis database'),
}

if __name__ == '__main__':
    options = initOptions(params=_defaultOptions)
    initLogs(options)

    log.info('Starting')

    log.info('Connecting to datastore')
    db = dbRedis(options)

    if db.ping():
        loadSAdata()
        indexPage(db)

    log.info('done')
Ejemplo n.º 5
0
                s = '%12s\n%s' % ('reboot requested but not performed', r['output'])
            print s

        if options.stop:
            print host.graceful_shutdown()

_options = { 'reboot': ('-r', '--reboot', False, 'reboot host if required'),
             'info':   ('-i', '--info',   False, 'show passive info only, do not ssh to host'),
             'stop':   ('',   '--stop',   False, 'stop buildbot for host'),
           }


if __name__ == "__main__":
    options = initOptions(params=_options)

    initLogs(options, chatty=False, loglevel=logging.ERROR)

    log.debug('Starting')

    initKeystore(options)

    remoteEnv = releng.remote.RemoteEnvironment(options.tools, passive=options.info)

    for kitten in options.args:
        if kitten in remoteEnv.hosts:
            check(kitten)
        else:
            log.error('%s is not listed in slavealloc' % kitten)

    log.debug('Finished')