def main(): parser = get_parser() opts, args = parser.parse_args() configfile = opts.configfile xml_file = opts.productfile load_config(configfile) log_to_stream(sys.stderr) update_products(xml_file)
def main(): parser = get_parser() opts, args = parser.parse_args() load_config(opts.configfile) log_to_stream(sys.stderr) init_db(user_name=opts.user_name, password=opts.password, user_display_name=opts.display_name, user_email_address=opts.email_address)
def main(): parser = get_parser() opts,args = parser.parse_args() configfile = opts.configfile baseurl = opts.baseurl load_config(configfile) log_to_stream(sys.stderr) if opts.basepath: basepath = opts.basepath else: basepath = get("basepath.harness", "/var/www/beaker/harness") update_repos(baseurl=baseurl, basepath=basepath)
def setup_package(): log.info('Loading test configuration from %s', CONFIG_FILE) assert os.path.exists(CONFIG_FILE), 'Config file %s must exist' % CONFIG_FILE update_config(configfile=CONFIG_FILE, modulename='bkr.server.config') # Override loaded logging config, in case we are using the server's config file # (we really always want our tests' logs to go to stdout, not /var/log/beaker/) log_to_stream(sys.stdout, level=logging.NOTSET) from bkr.inttest import data_setup if not 'BEAKER_SKIP_INIT_DB' in os.environ: data_setup.setup_model() with session.begin(): data_setup.create_labcontroller() #always need a labcontroller data_setup.create_task(name=u'/distribution/install', requires= u'make gcc nfs-utils wget procmail redhat-lsb ntp ' u'@development-tools @development-libs @development ' u'@desktop-platform-devel @server-platform-devel ' u'libxml2-python expect pyOpenSSL'.split()) data_setup.create_task(name=u'/distribution/reservesys', requires=u'emacs vim-enhanced unifdef sendmail'.split()) data_setup.create_distro() if not os.path.exists(turbogears.config.get('basepath.rpms')): os.mkdir(turbogears.config.get('basepath.rpms')) setup_slapd() turbogears.testutil.make_app(Root) turbogears.testutil.start_server() if 'BEAKER_SERVER_BASE_URL' not in os.environ: # need to start the server ourselves # (this only works from the IntegrationTests dir of a Beaker checkout) processes.extend([ Process('beaker', args=['../Server/start-server.py', CONFIG_FILE], listen_port=turbogears.config.get('server.socket_port'), stop_signal=signal.SIGINT) ]) processes.extend([ Process('slapd', args=['slapd', '-d0', '-F/tmp/beaker-tests-slapd-config', '-hldap://127.0.0.1:3899/'], listen_port=3899, stop_signal=signal.SIGINT), ]) try: for process in processes: process.start() except: for process in processes: process.stop() raise
def main(): parser = OptionParser('usage: %prog [options]', description=__description__, version=__version__) parser.add_option('-c', '--config', metavar='FILENAME', help='Read configuration from FILENAME') parser.add_option('-k', '--keep', metavar='DAYS', help='Keep records which expired less than DAYS ago [default: %default]') parser.set_defaults(keep=7) options, args = parser.parse_args() from bkr.server.util import load_config, log_to_stream load_config(options.config) log_to_stream(sys.stderr) cleanup_visits(options.keep)
def main(): current_date = None parser = get_parser() opts, args = parser.parse_args() threshold = opts.threshold reservation_type = opts.reservation_type.decode(sys.stdin.encoding or "utf8") testing = opts.testing configfile = opts.configfile load_config(configfile) log_to_stream(sys.stderr) interface.start(config) get_engine() if testing: print "Dry run only, nothing will be sent\n" identify_nags(threshold, reservation_type, testing)
def main(): parser = optparse.OptionParser('usage: %prog [options]', description=__description__, version=__version__) parser.add_option('-c', '--config', metavar='FILENAME', help='Read configuration from FILENAME') parser.add_option('--debug', action='store_true', help='Print debugging messages to stderr') parser.set_defaults(debug=False) options, args = parser.parse_args() load_config(options.config) log_to_stream(sys.stderr, level=logging.DEBUG if options.debug else logging.WARNING) # beaker-server ships a cron job to run this command, so exit silently # and quickly if LDAP is not actually enabled. if not config.get('identity.ldap.enabled', False): return 0 refresh_ldap() return 0
def main(): parser = OptionParser('usage: %prog [options]', description='Permanently deletes log files from Beaker and/or ' 'archive server', version=__version__) parser.add_option('-c', '--config', metavar='FILENAME', help='Read configuration from FILENAME') parser.add_option('-v', '--verbose', action='store_true', help='Print the path/URL of deleted files to stdout') parser.add_option('--debug', action='store_true', help='Print debugging messages to stderr') parser.add_option('--dry-run', action='store_true', help='Do not delete any files, and issue ROLLBACK instead of ' 'COMMIT after performing database operations') parser.add_option('--limit', default=None, type='int', help='Set a limit on the number of jobs whose logs will be deleted') parser.set_defaults(verbose=False, debug=False, dry_run=False) options, args = parser.parse_args() load_config(options.config) # urllib3 installs a NullHandler, we can just remove it and let the messages propagate logging.getLogger('requests.packages.urllib3').handlers[:] = [] log_to_stream(sys.stderr, level=logging.DEBUG if options.debug else logging.WARNING) return log_delete(options.verbose, options.dry_run, options.limit)
import sys import os.path import datetime from turbogears.database import session from bkr.server.util import load_config, log_to_stream from bkr.server.model import Task from bkr.server import testinfo def populate(task): from bkr.server.tasks import Tasks controller = Tasks() filename = os.path.join(controller.task_dir, task.rpm) if not os.path.exists(filename): print 'Skipping missing %s' % filename return raw_taskinfo = controller.read_taskinfo(filename) tinfo = testinfo.parse_string(raw_taskinfo['desc'], raise_errors=False) if tinfo.owner: task.owner = tinfo.owner.decode('utf8') if tinfo.priority: task.priority = tinfo.priority.decode('utf8') task.destructive = tinfo.destructive if __name__ == '__main__': load_config() log_to_stream(sys.stderr) session.begin() for task in Task.query.filter(Task.valid == True): populate(task) session.commit()