本文整理汇总了Python中trove.common.utils.import_class函数的典型用法代码示例。如果您正苦于以下问题:Python import_class函数的具体用法?Python import_class怎么用?Python import_class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了import_class函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, dns_driver=None, dns_instance_entry_factory=None,
*args, **kwargs):
if not dns_driver:
dns_driver = CONF.dns_driver
dns_driver = utils.import_class(dns_driver)
self.driver = dns_driver()
if not dns_instance_entry_factory:
dns_instance_entry_factory = CONF.dns_instance_entry_factory
entry_factory = utils.import_class(dns_instance_entry_factory)
self.entry_factory = entry_factory()
开发者ID:AlexeyDeyneko,项目名称:trove,代码行数:11,代码来源:manager.py
示例2: test_backup_decrypted_xtrabackup_with_extra_opts_command
def test_backup_decrypted_xtrabackup_with_extra_opts_command(self):
backupBase.BackupRunner.is_zipped = True
backupBase.BackupRunner.is_encrypted = False
RunnerClass = utils.import_class(BACKUP_XTRA_CLS)
bkup = RunnerClass(12345, extra_opts="--no-lock")
self.assertEqual(XTRA_BACKUP_EXTRA_OPTS + PIPE + ZIP, bkup.command)
self.assertEqual("12345.xbstream.gz", bkup.manifest)
开发者ID:tarunmohanty,项目名称:trove,代码行数:7,代码来源:test_backups.py
示例3: test_restore_decrypted_xtrabackup_command
def test_restore_decrypted_xtrabackup_command(self):
restoreBase.RestoreRunner.is_zipped = True
restoreBase.RestoreRunner.is_encrypted = False
RunnerClass = utils.import_class(RESTORE_XTRA_CLS)
restr = RunnerClass(None, restore_location="/var/lib/mysql")
self.assertEqual(restr.restore_cmd, UNZIP + PIPE + XTRA_RESTORE)
self.assertEqual(restr.prepare_cmd, PREPARE)
开发者ID:CiscoSystems,项目名称:openstack-trove,代码行数:7,代码来源:test_backups.py
示例4: test_backup_decrypted_mysqldump_command
def test_backup_decrypted_mysqldump_command(self):
backupBase.BackupRunner.is_zipped = True
backupBase.BackupRunner.is_encrypted = False
RunnerClass = utils.import_class(BACKUP_SQLDUMP_CLS)
bkup = RunnerClass(12345, extra_opts="")
self.assertEqual(SQLDUMP_BACKUP + PIPE + ZIP, bkup.command)
self.assertEqual("12345.gz", bkup.manifest)
开发者ID:tarunmohanty,项目名称:trove,代码行数:7,代码来源:test_backups.py
示例5: test_restore_encrypted_mysqldump_command
def test_restore_encrypted_mysqldump_command(self):
restoreBase.RestoreRunner.is_zipped = True
restoreBase.RestoreRunner.is_encrypted = True
restoreBase.RestoreRunner.decrypt_key = CRYPTO_KEY
RunnerClass = utils.import_class(RESTORE_SQLDUMP_CLS)
restr = RunnerClass(None, restore_location="/var/lib/mysql", user="user", password="password")
self.assertEqual(restr.restore_cmd, DECRYPT + PIPE + UNZIP + PIPE + SQLDUMP_RESTORE)
开发者ID:rgeethapriya,项目名称:trove,代码行数:7,代码来源:test_backups.py
示例6: test_backup_encrypted_xtrabackup_command
def test_backup_encrypted_xtrabackup_command(self):
backupBase.BackupRunner.encrypt_key = CRYPTO_KEY
RunnerClass = utils.import_class(BACKUP_XTRA_CLS)
bkup = RunnerClass(12345, extra_opts="")
self.assertEqual(XTRA_BACKUP + PIPE + ZIP + PIPE + ENCRYPT,
bkup.command)
self.assertEqual("12345.xbstream.gz.enc", bkup.manifest)
开发者ID:Tesora-Release,项目名称:tesora-trove,代码行数:7,代码来源:test_backups.py
示例7: test_restore_decrypted_mysqldump_command
def test_restore_decrypted_mysqldump_command(self):
restoreBase.RestoreRunner.is_zipped = True
restoreBase.RestoreRunner.is_encrypted = False
RunnerClass = utils.import_class(RESTORE_SQLDUMP_CLS)
restr = RunnerClass(None, restore_location="/var/lib/mysql/data",
location="filename", checksum="md5")
self.assertEqual(UNZIP + PIPE + SQLDUMP_RESTORE, restr.restore_cmd)
开发者ID:tarunmohanty,项目名称:trove,代码行数:7,代码来源:test_backups.py
示例8: setUp
def setUp(self, _):
super(MongodbRestoreTests, self).setUp()
self.restore_runner = utils.import_class(
RESTORE_MONGODUMP_CLS)('swift', location='http://some.where',
checksum='True_checksum',
restore_location='/var/lib/somewhere')
开发者ID:tarunmohanty,项目名称:trove,代码行数:7,代码来源:test_backups.py
示例9: test_backup_decrypted_mysqldump_with_extra_opts_command
def test_backup_decrypted_mysqldump_with_extra_opts_command(self):
backupBase.BackupRunner.is_zipped = True
backupBase.BackupRunner.is_encrypted = False
RunnerClass = utils.import_class(BACKUP_SQLDUMP_CLS)
bkup = RunnerClass(12345, extra_opts="--events --routines --triggers")
self.assertEqual(bkup.command, SQLDUMP_BACKUP_EXTRA_OPTS + PIPE + ZIP)
self.assertEqual(bkup.manifest, "12345.gz")
开发者ID:rumale,项目名称:trove,代码行数:7,代码来源:test_backups.py
示例10: test_restore_decrypted_cbbackup_command
def test_restore_decrypted_cbbackup_command(self):
restoreBase.RestoreRunner.is_zipped = True
restoreBase.RestoreRunner.is_encrypted = False
RunnerClass = utils.import_class(RESTORE_CBBACKUP_CLS)
restr = RunnerClass(None, restore_location="/tmp",
location="filename", checksum="md5")
self.assertEqual(UNZIP + PIPE + CBBACKUP_RESTORE, restr.restore_cmd)
开发者ID:tarunmohanty,项目名称:trove,代码行数:7,代码来源:test_backups.py
示例11: setUp
def setUp(self):
super(RedisRestoreTests, self).setUp()
self.conf_man_patch = patch.object(
configuration.ConfigurationManager, 'parse_configuration',
mock.Mock(return_value={'dir': '/var/lib/redis',
'dbfilename': 'dump.rdb'}))
self.conf_man_patch.start()
self.addCleanup(self.conf_man_patch.stop)
self.os_patch = patch.multiple(operating_system,
chown=DEFAULT,
create_directory=DEFAULT)
self.os_patch.start()
self.addCleanup(self.os_patch.stop)
self.restore_runner = utils.import_class(
RESTORE_REDIS_CLS)('swift', location='http://some.where',
checksum='True_checksum',
restore_location='/var/lib/somewhere')
self.restore_runner_patch = patch.multiple(
self.restore_runner, _run_restore=DEFAULT,
pre_restore=DEFAULT, post_restore=DEFAULT)
self.restore_runner_mocks = self.restore_runner_patch.start()
self.expected_content_length = 123
self.restore_runner._run_restore = mock.Mock(
return_value=self.expected_content_length)
self.addCleanup(self.restore_runner_patch.stop)
开发者ID:Tesora-Release,项目名称:tesora-trove,代码行数:26,代码来源:test_backups.py
示例12: test_restore_decrypted_xtrabackup_command
def test_restore_decrypted_xtrabackup_command(self):
restoreBase.RestoreRunner.is_encrypted = False
RunnerClass = utils.import_class(RESTORE_XTRA_CLS)
restr = RunnerClass(None, restore_location="/var/lib/mysql/data",
location="filename", checksum="md5")
self.assertEqual(UNZIP + PIPE + XTRA_RESTORE, restr.restore_cmd)
self.assertEqual(PREPARE, restr.prepare_cmd)
开发者ID:Tesora-Release,项目名称:tesora-trove,代码行数:7,代码来源:test_backups.py
示例13: test_backup_decrypted_xtrabackup_command
def test_backup_decrypted_xtrabackup_command(self):
backupBase.BackupRunner.is_zipped = True
backupBase.BackupRunner.is_encrypted = False
RunnerClass = utils.import_class(BACKUP_XTRA_CLS)
bkup = RunnerClass(12345, extra_opts="")
self.assertEqual(bkup.command, XTRA_BACKUP + PIPE + ZIP)
self.assertEqual(bkup.manifest, "12345.xbstream.gz")
开发者ID:rumale,项目名称:trove,代码行数:7,代码来源:test_backups.py
示例14: test_restore_encrypted_redisbackup_command
def test_restore_encrypted_redisbackup_command(self, *mocks):
restoreBase.RestoreRunner.decrypt_key = CRYPTO_KEY
RunnerClass = utils.import_class(RESTORE_REDIS_CLS)
restr = RunnerClass(None, restore_location="/tmp",
location="filename", checksum="md5")
self.assertEqual(restr.restore_cmd,
DECRYPT + PIPE + UNZIP + PIPE + REDISBACKUP_RESTORE)
开发者ID:Tesora-Release,项目名称:tesora-trove,代码行数:7,代码来源:test_backups.py
示例15: test_restore_encrypted_couchdbbackup_command
def test_restore_encrypted_couchdbbackup_command(self):
restoreBase.RestoreRunner.decrypt_key = CRYPTO_KEY
RunnerClass = utils.import_class(RESTORE_COUCHDB_BACKUP_CLS)
restr = RunnerClass(None, restore_location="/var/lib/couchdb",
location="filename", checksum="md5")
self.assertEqual(DECRYPT + PIPE + UNZIP + PIPE + COUCHDB_RESTORE_CMD,
restr.restore_cmd)
开发者ID:Tesora-Release,项目名称:tesora-trove,代码行数:7,代码来源:test_backups.py
示例16: test_restore_encrypted_mongodump_command
def test_restore_encrypted_mongodump_command(self, _):
restoreBase.RestoreRunner.decrypt_key = CRYPTO_KEY
RunnerClass = utils.import_class(RESTORE_MONGODUMP_CLS)
restr = RunnerClass(None, restore_location="/tmp",
location="filename", checksum="md5")
self.assertEqual(restr.restore_cmd,
DECRYPT + PIPE + UNZIP + PIPE + MONGODUMP_RESTORE)
开发者ID:Tesora-Release,项目名称:tesora-trove,代码行数:7,代码来源:test_backups.py
示例17: test_restore_encrypted_mysqldump_command
def test_restore_encrypted_mysqldump_command(self):
restoreBase.RestoreRunner.decrypt_key = CRYPTO_KEY
RunnerClass = utils.import_class(RESTORE_SQLDUMP_CLS)
restr = RunnerClass(None, restore_location="/var/lib/mysql/data",
location="filename", checksum="md5")
self.assertEqual(DECRYPT + PIPE + UNZIP + PIPE + SQLDUMP_RESTORE,
restr.restore_cmd)
开发者ID:Tesora-Release,项目名称:tesora-trove,代码行数:7,代码来源:test_backups.py
示例18: test_restore_decrypted_mongodump_command
def test_restore_decrypted_mongodump_command(self):
restoreBase.RestoreRunner.is_zipped = True
restoreBase.RestoreRunner.is_encrypted = False
RunnerClass = utils.import_class(RESTORE_MONGODUMP_CLS)
restr = RunnerClass(None, restore_location="/tmp",
location="filename", checksum="md5")
self.assertEqual(restr.restore_cmd, UNZIP + PIPE + MONGODUMP_RESTORE)
开发者ID:rumale,项目名称:trove,代码行数:7,代码来源:test_backups.py
示例19: test_backup_decrypted_mysqldump_command
def test_backup_decrypted_mysqldump_command(self):
backupBase.BackupRunner.is_zipped = True
backupBase.BackupRunner.is_encrypted = False
RunnerClass = utils.import_class(BACKUP_SQLDUMP_CLS)
bkup = RunnerClass(12345, user="user", password="password")
self.assertEqual(bkup.command, SQLDUMP_BACKUP + PIPE + ZIP)
self.assertEqual(bkup.manifest, "12345.gz")
开发者ID:CiscoSystems,项目名称:openstack-trove,代码行数:7,代码来源:test_backups.py
示例20: load_taskmanager_strategy
def load_taskmanager_strategy(manager):
try:
clazz = CONF.get(manager).get('taskmanager_strategy')
LOG.debug("Loading class %s" % clazz)
taskmanager_strategy = import_class(clazz)
return taskmanager_strategy()
except NoSuchOptError:
return None
开发者ID:arisu1000,项目名称:trove,代码行数:8,代码来源:strategy.py
注:本文中的trove.common.utils.import_class函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论