本文整理汇总了Python中pulp_rpm.plugins.distributors.export_distributor.export_utils.validate_export_config函数的典型用法代码示例。如果您正苦于以下问题:Python validate_export_config函数的具体用法?Python validate_export_config怎么用?Python validate_export_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了validate_export_config函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_none_iso_prefix
def test_none_iso_prefix(self):
# Setup
self.repo_config[constants.ISO_PREFIX_KEYWORD] = None
# Test
result = export_utils.validate_export_config(PluginCallConfiguration({}, self.repo_config))
self.assertFalse(result[0])
示例2: validate_config
def validate_config(self, repo_group, config, config_conduit):
"""
Allows the distributor to check the contents of a potential configuration
for the given repository. This call is made both for the addition of
this distributor to a new repository group, as well as updating the configuration
for this distributor on a previously configured repository.
The return is a tuple of the result of the validation (True for success,
False for failure) and a message. The message may be None and is unused
in the success case. If the message is not None, i18n is taken into
consideration when generating the message.
The related_repo_groups parameter contains a list of other repository groups that
have a configured distributor of this type. The distributor configurations
is found in each repository group in the "plugin_configs" field.
:param repo_group: metadata describing the repository to which the configuration
applies
:type repo_group: pulp.plugins.model.Repository
:param config: plugin configuration instance
:type config: pulp.plugins.config.PluginCallConfiguration
:param config_conduit: Configuration Conduit;
:type config_conduit: pulp.plugins.conduits.repo_validate.RepoConfigConduit
:return: tuple of (bool, str) to describe the result
:rtype: tuple
"""
return export_utils.validate_export_config(config)
示例3: test_non_absolute_path
def test_non_absolute_path(self):
# Setup
self.repo_config[constants.EXPORT_DIRECTORY_KEYWORD] = 'non/absolute/path'
# Test that if the export directory isn't found, validation fails
result = export_utils.validate_export_config(PluginCallConfiguration({}, self.repo_config))
self.assertFalse(result[0])
示例4: test_none_path
def test_none_path(self):
# Setup
self.repo_config[constants.EXPORT_DIRECTORY_KEYWORD] = None
# Test
result = export_utils.validate_export_config(PluginCallConfiguration({}, self.repo_config))
self.assertFalse(result[0])
示例5: publish_group
def publish_group(self, repo_group, publish_conduit, config):
"""
Publishes the given repository group.
:param repo_group: metadata describing the repository group
:type repo_group: pulp.plugins.model.RepositoryGroup
:param publish_conduit: provides access to relevant Pulp functionality
:type publish_conduit: pulp.plugins.conduits.repo_publish.RepoGroupPublishConduit
:param config: plugin configuration
:type config: pulp.plugins.config.PluginConfiguration
:return: report describing the publish run
:rtype: pulp.plugins.model.PublishReport
"""
# First, validate the configuration because there may be override config options,
# and currently,
# validate_config is not called prior to publishing by the manager.
valid_config, msg = export_utils.validate_export_config(config)
if not valid_config:
raise PulpDataException(msg)
# raises a PulpCodedException if all units are not downloaded
self.ensure_all_units_downloaded(repo_group)
_logger.info('Beginning export of the following repository group: [%s]' % repo_group.id)
self._publisher = ExportRepoGroupPublisher(repo_group, publish_conduit, config,
ids.TYPE_ID_DISTRIBUTOR_GROUP_EXPORT)
return self._publisher.process_lifecycle()
示例6: test_bad_start_date
def test_bad_start_date(self):
# Setup
self.repo_config[constants.START_DATE_KEYWORD] = 'malformed date'
# Test
result = export_utils.validate_export_config(PluginCallConfiguration({}, self.repo_config))
self.assertFalse(result[0])
示例7: publish_repo
def publish_repo(self, transfer_repo, publish_conduit, config):
"""
Export a yum repository to a given directory, or to ISO
:param transfer_repo: metadata describing the repository
:type transfer_repo: pulp.plugins.model.Repository
:param publish_conduit: provides access to relevant Pulp functionality
:type publish_conduit: pulp.plugins.conduits.repo_publish.RepoPublishConduit
:param config: plugin configuration
:type config: pulp.plugins.config.PluginConfiguration
:return: report describing the publish run
:rtype: pulp.plugins.model.PublishReport
"""
# First, validate the configuration because there may be override config options, and
# currently, validate_config is not called prior to publishing by the manager.
valid_config, msg = export_utils.validate_export_config(config)
if not valid_config:
raise PulpDataException(msg)
# raises a PulpCodedException if all units are not downloaded
self.ensure_all_units_downloaded(transfer_repo.id)
_logger.info('Starting export of [%s]' % transfer_repo.id)
self._publisher = ExportRepoPublisher(transfer_repo, publish_conduit, config,
ids.TYPE_ID_DISTRIBUTOR_EXPORT)
return self._publisher.process_lifecycle()
示例8: test_bad_skip_config
def test_bad_skip_config(self):
# Setup
self.repo_config[constants.SKIP_KEYWORD] = 'not a list'
# Test that a skip list that isn't a list fails to validate
result = export_utils.validate_export_config(PluginCallConfiguration({}, self.repo_config))
self.assertFalse(result[0])
示例9: test_bad_iso_size_config
def test_bad_iso_size_config(self):
# Setup
self.repo_config[constants.ISO_SIZE_KEYWORD] = -55
# Test that a prefix with invalid characters fails validation
result = export_utils.validate_export_config(PluginCallConfiguration({}, self.repo_config))
self.assertFalse(result[0])
示例10: test_none_https
def test_none_https(self):
# Setup
self.repo_config[constants.PUBLISH_HTTPS_KEYWORD] = None
# Test
result = export_utils.validate_export_config(PluginCallConfiguration({}, self.repo_config))
self.assertFalse(result[0])
示例11: test_none_end_date
def test_none_end_date(self):
# Setup
self.repo_config[constants.END_DATE_KEYWORD] = None
# Test
result = export_utils.validate_export_config(PluginCallConfiguration({}, self.repo_config))
self.assertFalse(result[0])
示例12: test_missing_export_dir
def test_missing_export_dir(self, mock_isdir):
# Setup
self.repo_config[constants.EXPORT_DIRECTORY_KEYWORD] = '/directory/not/found'
mock_isdir.return_value = False
# Test that if the export directory isn't found, validation fails
result = export_utils.validate_export_config(PluginCallConfiguration({}, self.repo_config))
self.assertFalse(result[0])
示例13: test_unwritable_export_dir
def test_unwritable_export_dir(self, mock_isdir, mock_access):
# Setup
self.repo_config[constants.EXPORT_DIRECTORY_KEYWORD] = '/some/dir'
mock_isdir.return_value = True
mock_access.return_value = False
# Test that if the export directory isn't writable, validation fails
result = export_utils.validate_export_config(PluginCallConfiguration({}, self.repo_config))
self.assertFalse(result[0])
示例14: test_full_config
def test_full_config(self):
self.repo_config[constants.SKIP_KEYWORD] = []
self.repo_config[constants.ISO_PREFIX_KEYWORD] = 'prefix'
self.repo_config[constants.ISO_SIZE_KEYWORD] = 630
self.repo_config[constants.EXPORT_DIRECTORY_KEYWORD] = export_dir = '/path/to/dir'
self.repo_config[constants.START_DATE_KEYWORD] = '2013-07-18T11:22:00'
self.repo_config[constants.END_DATE_KEYWORD] = '2013-07-18T11:23:00'
result, msg = export_utils.validate_export_config(PluginCallConfiguration({}, self.repo_config))
self.assertTrue(result)
示例15: test_full_config
def test_full_config(self):
self.repo_config[constants.SKIP_KEYWORD] = []
self.repo_config[constants.ISO_PREFIX_KEYWORD] = "prefix"
self.repo_config[constants.ISO_SIZE_KEYWORD] = 630
self.repo_config[constants.EXPORT_DIRECTORY_KEYWORD] = "/path/to/dir"
self.repo_config[constants.START_DATE_KEYWORD] = "2013-07-18T11:22:00"
self.repo_config[constants.END_DATE_KEYWORD] = "2013-07-18T11:23:00"
self.repo_config[constants.CREATE_PULP_MANIFEST] = True
result, msg = export_utils.validate_export_config(PluginCallConfiguration({}, self.repo_config))
self.assertTrue(result)