Beispiel #1
0
    def bind(group_id, repo_id, distributor_id, notify_agent, binding_config,
             agent_options):
        """
        Bind the members of the specified consumer group.

        :param group_id:       A consumer group ID.
        :type group_id:        str
        :param repo_id:        A repository ID.
        :type repo_id:         str
        :param distributor_id: A distributor ID.
        :type distributor_id:  str
        :param agent_options:  Bind options passed to the agent handler.
        :type agent_options:   dict
        :param notify_agent:   indicates if the agent should be sent a message about the new binding
        :type  notify_agent:   bool
        :param binding_config: configuration options to use when generating the payload for this
                               binding
        :type binding_config:  dict
        :return:               Details of the subtasks that were executed
        :rtype:                TaskResult
        """
        manager = manager_factory.consumer_group_query_manager()
        group = manager.get_group(group_id)

        bind_errors = []
        additional_tasks = []

        for consumer_id in group['consumer_ids']:
            try:
                report = bind_task(consumer_id, repo_id, distributor_id,
                                   notify_agent, binding_config, agent_options)
                if report.spawned_tasks:
                    additional_tasks.extend(report.spawned_tasks)
            except PulpException, e:
                # Log a message so that we can debug but don't throw
                _logger.debug(e.message)
                bind_errors.append(e)
            except Exception, e:
                _logger.exception(e.message)
                # Don't do anything else since we still want to process all the other consumers
                bind_errors.append(e)
Beispiel #2
0
Datei: cud.py Projekt: beav/pulp
    def bind(group_id, repo_id, distributor_id, notify_agent, binding_config, agent_options):
        """
        Bind the members of the specified consumer group.

        :param group_id:       A consumer group ID.
        :type group_id:        str
        :param repo_id:        A repository ID.
        :type repo_id:         str
        :param distributor_id: A distributor ID.
        :type distributor_id:  str
        :param agent_options:  Bind options passed to the agent handler.
        :type agent_options:   dict
        :param notify_agent:   indicates if the agent should be sent a message about the new binding
        :type  notify_agent:   bool
        :param binding_config: configuration options to use when generating the payload for this
                               binding
        :type binding_config:  dict
        :return:               Details of the subtasks that were executed
        :rtype:                TaskResult
        """
        manager = manager_factory.consumer_group_query_manager()
        group = manager.get_group(group_id)

        bind_errors = []
        additional_tasks = []

        for consumer_id in group['consumer_ids']:
            try:
                report = bind_task(consumer_id, repo_id, distributor_id, notify_agent,
                                   binding_config, agent_options)
                if report.spawned_tasks:
                    additional_tasks.extend(report.spawned_tasks)
            except PulpException, e:
                # Log a message so that we can debug but don't throw
                _logger.debug(e.message)
                bind_errors.append(e)
            except Exception, e:
                _logger.exception(e.message)
                # Don't do anything else since we still want to process all the other consumers
                bind_errors.append(e)