示例#1
0
def action_shell(params):
    from nailgun.db import db
    from nailgun.settings import settings

    if params.config_file:
        settings.update_from_file(params.config_file)
    try:
        from IPython import embed
        embed()
    except ImportError:
        code.interact(local={'db': db, 'settings': settings})
示例#2
0
文件: manage.py 项目: MsiRgb/fuel-web
def action_shell(params):
    from nailgun.db import db
    from nailgun.settings import settings

    if params.config_file:
        settings.update_from_file(params.config_file)
    try:
        from IPython import embed
        embed()
    except ImportError:
        code.interact(local={'db': db, 'settings': settings})
示例#3
0
文件: manage.py 项目: MsiRgb/fuel-web
def action_run(params):
    from nailgun.settings import settings

    settings.update({
        'LISTEN_PORT': int(params.port),
        'LISTEN_ADDRESS': params.address,
    })
    for attr in ['FAKE_TASKS', 'FAKE_TASKS_TICK_COUNT',
                 'FAKE_TASKS_TICK_INTERVAL', 'FAKE_TASKS_AMQP']:
        param = getattr(params, attr.lower())
        if param is not None:
            settings.update({attr: param})
    if params.config_file:
        settings.update_from_file(params.config_file)
    from nailgun.app import appstart
    appstart()
示例#4
0
def action_run(params):
    from nailgun.settings import settings

    settings.update({
        'LISTEN_PORT': int(params.port),
        'LISTEN_ADDRESS': params.address,
    })
    for attr in ['FAKE_TASKS', 'FAKE_TASKS_TICK_COUNT',
                 'FAKE_TASKS_TICK_INTERVAL', 'FAKE_TASKS_AMQP']:
        param = getattr(params, attr.lower())
        if param is not None:
            settings.update({attr: param})
    if params.config_file:
        settings.update_from_file(params.config_file)
    from nailgun.app import appstart
    appstart()
示例#5
0
文件: manage.py 项目: mba811/fuel-web
def action_run(params):
    from nailgun.settings import settings

    settings.update({"LISTEN_PORT": int(params.port), "LISTEN_ADDRESS": params.address})
    for attr in ["FAKE_TASKS", "FAKE_TASKS_TICK_COUNT", "FAKE_TASKS_TICK_INTERVAL", "FAKE_TASKS_AMQP"]:
        param = getattr(params, attr.lower())
        if param is not None:
            settings.update({attr: param})

    if params.authentication_method:
        auth_method = params.authentication_method
        settings.AUTH.update({"AUTHENTICATION_METHOD": auth_method})

    if params.config_file:
        settings.update_from_file(params.config_file)
    from nailgun.app import appstart

    appstart()
示例#6
0
def action_dbshell(params):
    from nailgun.settings import settings

    if params.config_file:
        settings.update_from_file(params.config_file)

    args = ['psql']
    env = {}
    if settings.DATABASE['passwd']:
        env['PGPASSWORD'] = settings.DATABASE['passwd']
    if settings.DATABASE['user']:
        args += ["-U", settings.DATABASE['user']]
    if settings.DATABASE['host']:
        args.extend(["-h", settings.DATABASE['host']])
    if settings.DATABASE['port']:
        args.extend(["-p", str(settings.DATABASE['port'])])
    args += [settings.DATABASE['name']]
    if os.name == 'nt':
        sys.exit(os.system(" ".join(args)))
    else:
        os.execvpe('psql', args, env)
示例#7
0
def action_dbshell(params):
    from nailgun.settings import settings

    if params.config_file:
        settings.update_from_file(params.config_file)

    args = ['psql']
    env = {}
    if settings.DATABASE['passwd']:
        env['PGPASSWORD'] = settings.DATABASE['passwd']
    if settings.DATABASE['user']:
        args += ["-U", settings.DATABASE['user']]
    if settings.DATABASE['host']:
        args.extend(["-h", settings.DATABASE['host']])
    if settings.DATABASE['port']:
        args.extend(["-p", str(settings.DATABASE['port'])])
    args += [settings.DATABASE['name']]
    if os.name == 'nt':
        sys.exit(os.system(" ".join(args)))
    else:
        os.execvpe('psql', args, env)
示例#8
0
文件: manage.py 项目: mba811/fuel-web
def action_dbshell(params):
    from nailgun.settings import settings

    if params.config_file:
        settings.update_from_file(params.config_file)

    args = ["psql"]
    env = {}
    if settings.DATABASE["passwd"]:
        env["PGPASSWORD"] = settings.DATABASE["passwd"]
    if settings.DATABASE["user"]:
        args += ["-U", settings.DATABASE["user"]]
    if settings.DATABASE["host"]:
        args.extend(["-h", settings.DATABASE["host"]])
    if settings.DATABASE["port"]:
        args.extend(["-p", str(settings.DATABASE["port"])])
    args += [settings.DATABASE["name"]]
    if os.name == "nt":
        sys.exit(os.system(" ".join(args)))
    else:
        os.execvpe("psql", args, env)
示例#9
0
def action_run(params):
    from nailgun.settings import settings

    #并入参数中的配置
    settings.update({
        'LISTEN_PORT': int(params.port),
        'LISTEN_ADDRESS': params.address,
    })
    for attr in ['FAKE_TASKS', 'FAKE_TASKS_TICK_COUNT',
                 'FAKE_TASKS_TICK_INTERVAL', 'FAKE_TASKS_AMQP']:
        param = getattr(params, attr.lower())
        if param is not None:
            settings.update({attr: param})

    if params.authentication_method:
        auth_method = params.authentication_method
        settings.AUTH.update({'AUTHENTICATION_METHOD': auth_method})

    #如果参数中指定了配置文件,则也将其加入
    if params.config_file:
        settings.update_from_file(params.config_file)
    from nailgun.app import appstart
    #app启动
    appstart()
示例#10
0
文件: manage.py 项目: ilyinon/fuelweb
        fixman.upload_fixtures()
        logger.info("Done")
    elif params.action == "dump_settings":
        sys.stdout.write(settings.dump())
    elif params.action in ("run",):
        settings.update({
            'LISTEN_PORT': int(params.port),
            'LISTEN_ADDRESS': params.address,
        })
        for attr in ['FAKE_TASKS', 'FAKE_TASKS_TICK_COUNT',
                     'FAKE_TASKS_TICK_INTERVAL', 'FAKE_TASKS_AMQP']:
            param = getattr(params, attr.lower())
            if param is not None:
                settings.update({attr: param})
        if params.config_file:
            settings.update_from_file(params.config_file)
        from nailgun.wsgi import appstart
        appstart(keepalive=params.keepalive)
    elif params.action == "shell":
        from nailgun.db import db
        if params.config_file:
            settings.update_from_file(params.config_file)
        try:
            from IPython import embed
            embed()
        except ImportError:
            code.interact(local={'orm': orm, 'settings': settings})
        db().commit()
    else:
        parser.print_help()
示例#11
0
        logger.info("Done")
    elif params.action == "dump_settings":
        sys.stdout.write(settings.dump())
    elif params.action in ("run", ):
        settings.update({
            'LISTEN_PORT': int(params.port),
            'LISTEN_ADDRESS': params.address,
        })
        for attr in [
                'FAKE_TASKS', 'FAKE_TASKS_TICK_COUNT',
                'FAKE_TASKS_TICK_INTERVAL', 'FAKE_TASKS_AMQP'
        ]:
            param = getattr(params, attr.lower())
            if param is not None:
                settings.update({attr: param})
        if params.config_file:
            settings.update_from_file(params.config_file)
        from nailgun.wsgi import appstart
        appstart(keepalive=params.keepalive)
    elif params.action == "shell":
        from nailgun.db import db
        if params.config_file:
            settings.update_from_file(params.config_file)
        try:
            from IPython import embed
            embed()
        except ImportError:
            code.interact(local={'db': db, 'settings': settings})
    else:
        parser.print_help()