本文整理汇总了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')
示例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
示例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))
示例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
示例5: setUp
def setUp(self):
super(TestWalkDowngrade, self).setUp()
self.alembic_config = migration.get_neutron_config()
self.alembic_config.neutron_config = cfg.CONF
示例6: test_validate_revisions
def test_validate_revisions(self, *mocks):
cli.validate_revisions(cli.get_neutron_config())
示例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')
示例8: test_validate_labels
def test_validate_labels(self, *mocks):
cli.validate_labels(cli.get_neutron_config())