Ejemplo n.º 1
0
    def validate_config(self, repo, 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 as well as updating the configuration
        for this distributor on a previously configured repository.

        :param repo: metadata describing the repository to which the
                     configuration applies
        :type  repo: pulp.plugins.model.Repository

        :param config: plugin configuration instance; the proposed repo
                       configuration is found within
        :type  config: pulp.plugins.config.PluginCallConfiguration

        :param config_conduit: Configuration Conduit;
        :type  config_conduit: pulp.plugins.conduits.repo_config.RepoConfigConduit

        :return: tuple of (bool, str) to describe the result
        :rtype:  tuple
        """
        _LOG.debug(
            _('Validating iso repository configuration: %(repoid)s') %
            {'repoid': repo.id})
        return configuration.validate_config(repo, config, config_conduit)
Ejemplo n.º 2
0
def validate_rsync_distributor_config(repo, config, config_conduit):
    """
    Performs validation of configuration that is standard for all rsync distributors. Then performs
    extra validation needed for docker rsync.

    :param repo:   metadata describing the repository to which the
                   configuration applies
    :type  repo:   pulp.plugins.model.Repository
    :param config: Pulp configuration for the distributor
    :type  config: pulp.plugins.config.PluginCallConfiguration
    :param config_conduit: Configuration Conduit;
    :type  config_conduit: pulp.plugins.conduits.repo_config.RepoConfigConduit

    :return: tuple comprised of a boolean indicating whether validation succeeded or failed and a
             list of errors (if any)
    :rtype: (bool, list of strings) or (bool, None)
    :raises: PulpCodedValidationException if any validations failed
    """
    valid, errors = rsync_config.validate_config(repo, config, config_conduit)
    if valid:
        return validate_postdistributor(repo, config)
    else:
        return valid, errors
Ejemplo n.º 3
0
    def validate_config(self, repo, 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 as well as updating the configuration
        for this distributor on a previously configured repository.

        :param repo: metadata describing the repository to which the
                     configuration applies
        :type  repo: pulp.plugins.model.Repository

        :param config: plugin configuration instance; the proposed repo
                       configuration is found within
        :type  config: pulp.plugins.config.PluginCallConfiguration

        :param config_conduit: Configuration Conduit;
        :type  config_conduit: pulp.plugins.conduits.repo_config.RepoConfigConduit

        :return: tuple of (bool, str) to describe the result
        :rtype:  tuple
        """
        _LOG.debug(_('Validating iso repository configuration: %(repoid)s') % {'repoid': repo.id})
        return configuration.validate_config(repo, config, config_conduit)
Ejemplo n.º 4
0
def validate_rsync_distributor_config(repo, config, config_conduit):
    """
    Performs validation of configuration that is standard for all rsync distributors. Then performs
    extra validation needed for docker rsync.

    :param repo:   metadata describing the repository to which the
                   configuration applies
    :type  repo:   pulp.plugins.model.Repository
    :param config: Pulp configuration for the distributor
    :type  config: pulp.plugins.config.PluginCallConfiguration
    :param config_conduit: Configuration Conduit;
    :type  config_conduit: pulp.plugins.conduits.repo_config.RepoConfigConduit

    :return: tuple comprised of a boolean indicating whether validation succeeded or failed and a
             list of errors (if any)
    :rtype: (bool, list of strings) or (bool, None)
    :raises: PulpCodedValidationException if any validations failed
    """
    valid, errors = rsync_config.validate_config(repo, config, config_conduit)
    if valid:
        return validate_postdistributor(repo, config)
    else:
        return valid, errors