Пример #1
0
    def post(self, request, consumer_group_id):
        """
        Create a bind association between the consumers belonging to the given
        consumer group by id included in the URL path and a repo-distributor
        specified in the POST body: {repo_id:<str>, distributor_id:<str>}.
        Designed to be idempotent so only MissingResource is expected to
        be raised by manager.

        :param request: WSGI request object
        :type request: django.core.handlers.wsgi.WSGIRequest
        :param consumer_group_id: The consumer group ID to bind.
        :type consumer_group_id: str
        :raises: MissingResource if group id does not exist
        :raises: InvalidValue some parameters are invalid
        :raises: OperationPostponed when an async operation is performed
        """
        params = request.body_as_json
        repo_id = params.get('repo_id')
        distributor_id = params.get('distributor_id')
        binding_config = params.get('binding_config', None)
        options = params.get('options', {})
        notify_agent = params.get('notify_agent', True)
        missing_resources = verify_group_resources(consumer_group_id, repo_id,
                                                   distributor_id)
        if missing_resources:
            if 'group_id' in missing_resources:
                raise pulp_exceptions.MissingResource(**missing_resources)
            else:
                raise pulp_exceptions.InvalidValue(list(missing_resources))
        bind_args_tuple = (consumer_group_id, repo_id, distributor_id,
                           notify_agent, binding_config, options)
        async_task = bind.apply_async(bind_args_tuple)
        raise pulp_exceptions.OperationPostponed(async_task)
Пример #2
0
    def POST(self, group_id):
        """
        Create a bind association between the consumers belonging to the given
        consumer group by id included in the URL path and a repo-distributor
        specified in the POST body: {repo_id:<str>, distributor_id:<str>}.
        Designed to be idempotent so only MissingResource is expected to
        be raised by manager.

        :param group_id: The consumer group to bind.
        :type group_id: str
        :return: list of call requests
        :rtype: list
        """
        body = self.params()
        repo_id = body.get('repo_id')
        distributor_id = body.get('distributor_id')
        binding_config = body.get('binding_config', None)
        options = body.get('options', {})
        notify_agent = body.get('notify_agent', True)

        missing_resources = verify_group_resources(group_id, repo_id,
                                                   distributor_id)
        if missing_resources:
            if 'group_id' in missing_resources:
                raise MissingResource(**missing_resources)
            else:
                raise InvalidValue(list(missing_resources))

        bind_args_tuple = (group_id, repo_id, distributor_id, notify_agent,
                           binding_config, options)
        async_task = bind.apply_async(bind_args_tuple)
        raise pulp_exceptions.OperationPostponed(async_task)
Пример #3
0
    def POST(self, group_id):
        """
        Create a bind association between the consumers belonging to the given
        consumer group by id included in the URL path and a repo-distributor
        specified in the POST body: {repo_id:<str>, distributor_id:<str>}.
        Designed to be idempotent so only MissingResource is expected to
        be raised by manager.

        :param group_id: The consumer group to bind.
        :type group_id: str
        :return: list of call requests
        :rtype: list
        """
        body = self.params()
        repo_id = body.get('repo_id')
        distributor_id = body.get('distributor_id')
        binding_config = body.get('binding_config', None)
        options = body.get('options', {})
        notify_agent = body.get('notify_agent', True)

        missing_resources = verify_group_resources(group_id, repo_id, distributor_id)
        if missing_resources:
            if 'group_id' in missing_resources:
                raise MissingResource(**missing_resources)
            else:
                raise InvalidValue(list(missing_resources))

        bind_args_tuple = (group_id, repo_id, distributor_id, notify_agent, binding_config,
                           options)
        async_task = bind.apply_async(bind_args_tuple)
        raise pulp_exceptions.OperationPostponed(async_task)
Пример #4
0
    def post(self, request, consumer_group_id):
        """
        Create a bind association between the consumers belonging to the given
        consumer group by id included in the URL path and a repo-distributor
        specified in the POST body: {repo_id:<str>, distributor_id:<str>}.
        Designed to be idempotent so only MissingResource is expected to
        be raised by manager.

        :param request: WSGI request object
        :type request: django.core.handlers.wsgi.WSGIRequest
        :param consumer_group_id: The consumer group ID to bind.
        :type consumer_group_id: str
        :raises: MissingResource if group id does not exist
        :raises: InvalidValue some parameters are invalid
        :raises: OperationPostponed when an async operation is performed
        """
        params = request.body_as_json
        repo_id = params.get('repo_id')
        distributor_id = params.get('distributor_id')
        binding_config = params.get('binding_config', None)
        options = params.get('options', {})
        notify_agent = params.get('notify_agent', True)
        missing_resources = verify_group_resources(consumer_group_id, repo_id, distributor_id)
        if missing_resources:
            if 'group_id' in missing_resources:
                raise pulp_exceptions.MissingResource(**missing_resources)
            else:
                raise pulp_exceptions.InvalidValue(list(missing_resources))
        bind_args_tuple = (consumer_group_id, repo_id, distributor_id, notify_agent,
                           binding_config, options)
        async_task = bind.apply_async(bind_args_tuple)
        raise pulp_exceptions.OperationPostponed(async_task)
Пример #5
0
 def POST(self, group_id):
     """
     Create a bind association between the specified
     consumer by id included in the URL path and a repo-distributor
     specified in the POST body: {repo_id:<str>, distributor_id:<str>}.
     Designed to be idempotent so only MissingResource is expected to
     be raised by manager.
     @param group_id: The consumer group to bind.
     @type group_id: str
     @return: The created bind model object:
         {consumer_group_id:<str>, repo_id:<str>, distributor_id:<str>}
     @rtype: dict
     """
     body = self.params()
     repo_id = body.get('repo_id')
     distributor_id = body.get('distributor_id')
     binding_config = body.get('binding_config', None)
     options = body.get('options', {})
     notify_agent = body.get('notify_agent', True)
     bind_args_tuple = (group_id, repo_id, distributor_id, notify_agent, binding_config,
                        options)
     async_task = bind.apply_async(bind_args_tuple)
     raise pulp_exceptions.OperationPostponed(async_task)