Beispiel #1
0
def init_db(options):
    from tkp.config import initialize_pipeline_config, get_database_config
    cfgfile = os.path.join(os.getcwd(), "pipeline.cfg")
    if os.path.exists(cfgfile):
        pipe_config = initialize_pipeline_config(cfgfile, "notset")
        dbconfig = get_database_config(pipe_config['database'], apply=False)
    else:
        dbconfig = get_database_config(None, apply=False)

    if 'engine' not in dbconfig or not dbconfig['engine']:
        dbconfig['engine'] = 'postgresql'

    if 'port' not in dbconfig or not dbconfig['port']:
        if dbconfig['engine'] == 'monetdb':
            dbconfig['port'] = 50000
        else:
            dbconfig['port'] = 5432

    if 'database' not in dbconfig or not dbconfig['database']:
        dbconfig['database'] = getpass.getuser()

    if 'user' not in dbconfig or not dbconfig['user']:
        dbconfig['user'] = dbconfig['database']

    if 'password' not in dbconfig or not dbconfig['password']:
        dbconfig['password'] = dbconfig['user']

    if 'host' not in dbconfig or not dbconfig['host']:
        dbconfig['host'] = 'localhost'

    dbconfig['yes'] = options.yes
    dbconfig['destroy'] = options.destroy

    populate(dbconfig)
Beispiel #2
0
def init_db(options):
    from tkp.config import initialize_pipeline_config, get_database_config
    cfgfile = os.path.join(os.getcwd(), "pipeline.cfg")
    if os.path.exists(cfgfile):
        pipe_config = initialize_pipeline_config(cfgfile, "notset")
        dbconfig = get_database_config(pipe_config['database'], apply=False)
    else:
        dbconfig = get_database_config(None, apply=False)

    dbconfig['yes'] = options.yes
    dbconfig['destroy'] = options.destroy

    populate(dbconfig)
Beispiel #3
0
def init_db(options):
    from tkp.config import initialize_pipeline_config, database_config
    pipe_config = initialize_pipeline_config(
                         os.path.join(os.getcwd(), "pipeline.cfg"),
                         "notset")
    dbconfig = database_config(pipe_config, apply=False)


    for field in ['engine', 'database', 'user', 'password', 'host', 'port',
                  'passphrase']:
        value = getattr(options, field)
        if value:
            dbconfig[field] = value

    if 'engine' not in dbconfig or not dbconfig['engine']:
        dbconfig['engine'] = 'postgresql'

    if 'port' not in dbconfig or not dbconfig['port']:
        if dbconfig['engine'] == 'monetdb':
            dbconfig['port'] = 50000
        else:
            dbconfig['port'] = 5432

    if 'database' not in dbconfig or not dbconfig['database']:
        dbconfig['database'] = getpass.getuser()

    if 'user' not in dbconfig or not dbconfig['user']:
        dbconfig['user'] = dbconfig['database']

    if 'password' not in dbconfig or not dbconfig['password']:
        dbconfig['password'] = dbconfig['user']

    if 'host' not in dbconfig or not dbconfig['host']:
        dbconfig['host'] = 'localhost'

    dbconfig['yes'] = options.yes

    if 'passphrase' not in dbconfig:
        dbconfig['passphrase'] = ""

    populate(dbconfig)
Beispiel #4
0
def init_db(options):
    dbconfig = get_db_config()
    dbconfig['yes'] = options.yes
    dbconfig['destroy'] = options.destroy
    populate(dbconfig)
Beispiel #5
0
def init_db(options):
    dbconfig = get_db_config()
    dbconfig['yes'] = options.yes
    dbconfig['destroy'] = options.destroy
    populate(dbconfig)