当前位置: 首页>>代码示例>>Python>>正文


Python cli.get_neutron_config函数代码示例

本文整理汇总了Python中neutron.db.migration.cli.get_neutron_config函数的典型用法代码示例。如果您正苦于以下问题:Python get_neutron_config函数的具体用法?Python get_neutron_config怎么用?Python get_neutron_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_neutron_config函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_db_tables

    def create_db_tables(self):
        """Populate the new database.

        MySQLTestCase creates a new database for each test, but these need to
        be populated with the appropriate tables. Before we can do that, we
        must change the 'connection' option which the Neutron code knows to
        look at.

        Currently, the username and password options are hard-coded by
        oslo.db and neutron/tests/functional/contrib/gate_hook.sh. Also,
        we only support MySQL for now, but the groundwork for adding Postgres
        is already laid.
        """
        conn = ("mysql+pymysql://%(username)s:%(password)s"
                "@127.0.0.1/%(db_name)s" % {
                    'username': test_base.DbFixture.USERNAME,
                    'password': test_base.DbFixture.PASSWORD,
                    'db_name': self.engine.url.database})

        alembic_config = migration.get_neutron_config()
        alembic_config.neutron_config = cfg.CONF
        self.original_conn = cfg.CONF.database.connection
        self.addCleanup(self._revert_connection_address)
        cfg.CONF.set_override('connection', conn, group='database')

        migration.do_alembic_command(alembic_config, 'upgrade', 'heads')
开发者ID:HoratiusTang,项目名称:neutron,代码行数:26,代码来源:base.py

示例2: _get_alembic_config

 def _get_alembic_config(self, uri):
     db_config = migration.get_neutron_config()
     self.script_dir = alembic_script.ScriptDirectory.from_config(db_config)
     db_config.neutron_config = cfg.CONF
     db_config.neutron_config.set_override('connection',
                                           six.text_type(uri),
                                           group='database')
     return db_config
开发者ID:jaguar13,项目名称:neutron,代码行数:8,代码来源:test_migrations.py

示例3: setUp

    def setUp(self):
        super(_TestModelsMigrations, self).setUp()
        self.cfg = self.useFixture(config_fixture.Config())
        self.cfg.config(core_plugin='ml2')
        self.alembic_config = migration.get_neutron_config()
        self.alembic_config.neutron_config = cfg.CONF

        # Migration tests can take a long time
        self.useFixture(test_base.Timeout(scaling=self.TIMEOUT_SCALING_FACTOR))
开发者ID:openstack,项目名称:neutron,代码行数:9,代码来源:test_migrations.py

示例4: setUp

 def setUp(self):
     patch = mock.patch.dict('sys.modules', {
         'heleosapi': mock.MagicMock(),
     })
     patch.start()
     self.addCleanup(patch.stop)
     super(_TestModelsMigrations, self).setUp()
     self.cfg = self.useFixture(config_fixture.Config())
     self.cfg.config(core_plugin=CORE_PLUGIN)
     self.alembic_config = migration.get_neutron_config()
     self.alembic_config.neutron_config = cfg.CONF
开发者ID:yizhongyin,项目名称:OpenstackLiberty,代码行数:11,代码来源:test_migrations.py

示例5: setUp

 def setUp(self):
     super(TestWalkDowngrade, self).setUp()
     self.alembic_config = migration.get_neutron_config()
     self.alembic_config.neutron_config = cfg.CONF
开发者ID:jaguar13,项目名称:neutron,代码行数:4,代码来源:test_migrations.py

示例6: test_validate_revisions

 def test_validate_revisions(self, *mocks):
     cli.validate_revisions(cli.get_neutron_config())
开发者ID:Blahhhhh,项目名称:neutron,代码行数:2,代码来源:test_migration.py

示例7: _generate_schema_w_migrations

 def _generate_schema_w_migrations(cls, engine):
     alembic_config = migration.get_neutron_config()
     with engine.connect() as conn:
         alembic_config.attributes['connection'] = conn
         migration.do_alembic_command(
             alembic_config, 'upgrade', 'heads')
开发者ID:gotostack,项目名称:neutron,代码行数:6,代码来源:testlib_api.py

示例8: test_validate_labels

 def test_validate_labels(self, *mocks):
     cli.validate_labels(cli.get_neutron_config())
开发者ID:yizhongyin,项目名称:OpenstackLiberty,代码行数:2,代码来源:test_migration.py


注:本文中的neutron.db.migration.cli.get_neutron_config函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。