• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tags.resource_tag函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pulp.common.tags.resource_tag函数的典型用法代码示例。如果您正苦于以下问题:Python resource_tag函数的具体用法?Python resource_tag怎么用?Python resource_tag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了resource_tag函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: put

    def put(self, request, repo_id, importer_id):
        """
        Associate an importer to a repository.

        :param request: WSGI request object
        :type  request: django.core.handlers.wsgi.WSGIRequest
        :param repo_id: The id of the repository
        :type  repo_id: str
        :param importer_id: The id of the importer to associate
        :type  importer_id: str

        :raises pulp_exceptions.MissingValue: if required param importer_config is not in the body
        :raises pulp_exceptions.MissingResource: if importer does not match the repo's importer
        :raises pulp_exceptions.OperationPostponed: dispatch a task
        """

        importer_manager = manager_factory.repo_importer_manager()
        importer = importer_manager.get_importer(repo_id)
        if importer['id'] != importer_id:
            raise pulp_exceptions.MissingResource(importer_id=importer_id)

        importer_config = request.body_as_json.get('importer_config', None)

        if importer_config is None:
            raise pulp_exceptions.MissingValue(['importer_config'])

        task_tags = [tags.resource_tag(tags.RESOURCE_REPOSITORY_TYPE, repo_id),
                     tags.resource_tag(tags.RESOURCE_REPOSITORY_IMPORTER_TYPE, importer_id),
                     tags.action_tag('update_importer')]
        async_result = repo_importer_manager.update_importer_config.apply_async_with_reservation(
            tags.RESOURCE_REPOSITORY_TYPE,
            repo_id, [repo_id], {'importer_config': importer_config}, tags=task_tags)
        raise pulp_exceptions.OperationPostponed(async_result)
开发者ID:hgschmie,项目名称:pulp,代码行数:33,代码来源:repositories.py


示例2: delete

    def delete(self, request, repo_id, distributor_id):
        """
        Disassociate the requested distributor.

        :param request: WSGI request object
        :type  request: django.core.handlers.wsgi.WSGIRequest
        :param repo_id: The id of the repository the to disassociate from
        :type  repo_id: str
        :param repo_id: The id of the distributor to disassociate
        :type  repo_id: str

        :raises pulp_exceptions.OperationPostponed: dispatch a task
        """

        # validate resources
        manager = manager_factory.repo_distributor_manager()
        manager.get_distributor(repo_id, distributor_id)

        task_tags = [
            tags.resource_tag(tags.RESOURCE_REPOSITORY_TYPE, repo_id),
            tags.resource_tag(tags.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE, distributor_id),
            tags.action_tag('remove_distributor')
        ]
        async_result = repo_tasks.distributor_delete.apply_async_with_reservation(
            tags.RESOURCE_REPOSITORY_TYPE, repo_id, [repo_id, distributor_id],
            tags=task_tags)
        raise pulp_exceptions.OperationPostponed(async_result)
开发者ID:hgschmie,项目名称:pulp,代码行数:27,代码来源:repositories.py


示例3: PUT

    def PUT(self, repo_id, distributor_id):
        """
        Used to update a repo distributor instance. This requires update permissions.
        The expected parameters are 'distributor_config', which is a dictionary containing
        configuration values accepted by the distributor type, and 'delta', which is a dictionary
        containing other configuration values for the distributor (like the auto_publish flag,
        for example). Currently, the only supported key in the delta is 'auto_publish', which
        should have a boolean value.

        :param repo_id:         The repository ID
        :type  repo_id:         str
        :param distributor_id:  The unique distributor ID of the distributor instance to update.
        :type  distributor_id:  str
        """
        params = self.params()
        delta = params.get("delta", None)
        # validate
        manager = manager_factory.repo_distributor_manager()
        manager.get_distributor(repo_id, distributor_id)
        config = params.get("distributor_config")
        if config is None:
            logger.error(
                "Missing configuration when updating distributor [%s] on repository [%s]", distributor_id, repo_id
            )
            raise exceptions.MissingValue(["distributor_config"])
        # update
        tags = [
            resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id),
            resource_tag(dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE, distributor_id),
            action_tag("update_distributor"),
        ]
        async_result = repository.distributor_update.apply_async_with_reservation(
            dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id, [repo_id, distributor_id, config, delta], tags=tags
        )
        raise exceptions.OperationPostponed(async_result)
开发者ID:preethit,项目名称:pulp-1,代码行数:35,代码来源:repositories.py


示例4: DELETE

 def DELETE(self, consumer_id, repo_id, distributor_id):
     """
     Delete a bind association between the specified
     consumer and repo-distributor.  Designed to be idempotent.
     @param consumer_id: A consumer ID.
     @type consumer_id: str
     @param repo_id: A repo ID.
     @type repo_id: str
     @param distributor_id: A distributor ID.
     @type distributor_id: str
     @return: The deleted bind model object:
         {consumer_id:<str>, repo_id:<str>, distributor_id:<str>}
         Or, None if bind does not exist.
     @rtype: dict
     """
     manager = managers.consumer_bind_manager()
     resources = {
         dispatch_constants.RESOURCE_CONSUMER_TYPE: {consumer_id: dispatch_constants.RESOURCE_READ_OPERATION},
         dispatch_constants.RESOURCE_REPOSITORY_TYPE: {repo_id: dispatch_constants.RESOURCE_READ_OPERATION},
         dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE: {
             distributor_id: dispatch_constants.RESOURCE_READ_OPERATION
         },
     }
     args = [consumer_id, repo_id, distributor_id]
     tags = [
         resource_tag(dispatch_constants.RESOURCE_CONSUMER_TYPE, consumer_id),
         resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id),
         resource_tag(dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE, distributor_id),
         action_tag("unbind"),
     ]
     call_request = CallRequest(manager.unbind, args=args, resources=resources, tags=tags)
     return self.ok(execution.execute(call_request))
开发者ID:ehelms,项目名称:pulp,代码行数:32,代码来源:consumers.py


示例5: DELETE

    def DELETE(self, repo_id, distributor_id, schedule_id):
        distributor_manager = manager_factory.repo_distributor_manager()
        schedule_list = distributor_manager.list_publish_schedules(repo_id, distributor_id)
        if schedule_id not in schedule_list:
            raise exceptions.MissingResource(repo=repo_id, distributor=distributor_id, publish_schedule=schedule_id)

        schedule_manager = manager_factory.schedule_manager()
        resources = {
            dispatch_constants.RESOURCE_REPOSITORY_TYPE: {repo_id: dispatch_constants.RESOURCE_READ_OPERATION},
            dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE: {
                distributor_id: dispatch_constants.RESOURCE_UPDATE_OPERATION
            },
            dispatch_constants.RESOURCE_SCHEDULE_TYPE: {schedule_id: dispatch_constants.RESOURCE_DELETE_OPERATION},
        }
        tags = [
            resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id),
            resource_tag(dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE, distributor_id),
            resource_tag(dispatch_constants.RESOURCE_SCHEDULE_TYPE, schedule_id),
            action_tag("delete_publish_schedule"),
        ]
        call_request = CallRequest(
            schedule_manager.delete_publish_schedule,
            [repo_id, distributor_id, schedule_id],
            resources=resources,
            tags=tags,
            archive=True,
        )
        return execution.execute_ok(self, call_request)
开发者ID:ehelms,项目名称:pulp,代码行数:28,代码来源:repositories.py


示例6: PUT

    def PUT(self, repo_id, distributor_id):

        # Params (validation will occur in the manager)
        params = self.params()
        distributor_config = params.get("distributor_config", None)

        if distributor_config is None:
            _LOG.exception(
                "Missing configuration when updating distributor [%s] on repository [%s]" % (distributor_id, repo_id)
            )
            raise exceptions.MissingValue(["distributor_config"])

        distributor_manager = manager_factory.repo_distributor_manager()
        resources = {
            dispatch_constants.RESOURCE_REPOSITORY_TYPE: {repo_id: dispatch_constants.RESOURCE_UPDATE_OPERATION},
            dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE: {
                distributor_id: dispatch_constants.RESOURCE_UPDATE_OPERATION
            },
        }
        tags = [
            resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id),
            resource_tag(dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE, distributor_id),
            action_tag("update_distributor"),
        ]
        call_request = CallRequest(
            distributor_manager.update_distributor_config,
            [repo_id, distributor_id, distributor_config],
            resources=resources,
            tags=tags,
            archive=True,
        )
        return execution.execute_ok(self, call_request)
开发者ID:ehelms,项目名称:pulp,代码行数:32,代码来源:repositories.py


示例7: POST

    def POST(self, repo_group_id):
        params = self.params()
        distributor_id = params.get('id', None)
        overrides = params.get('override_config', None)

        if distributor_id is None:
            raise MissingValue(['id'])

        publish_manager = managers_factory.repo_group_publish_manager()

        tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE, repo_group_id),
                resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_DISTRIBUTOR_TYPE, distributor_id),
                action_tag('publish')
        ]
        weight = pulp_config.config.getint('tasks', 'publish_weight')

        call_request = CallRequest(publish_manager.publish,
                                   args=[repo_group_id, distributor_id],
                                   kwargs={'publish_config_override' : overrides},
                                   tags=tags,
                                   weight=weight,
                                   archive=True)
        call_request.updates_resource(dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE, repo_group_id)
        call_request.updates_resource(dispatch_constants.RESOURCE_REPOSITORY_GROUP_DISTRIBUTOR_TYPE, distributor_id)
        call_request.add_life_cycle_callback(dispatch_constants.CALL_ENQUEUE_LIFE_CYCLE_CALLBACK, publish_manager.prep_publish)

        return execution.execute_async(self, call_request)
开发者ID:ehelms,项目名称:pulp,代码行数:27,代码来源:repo_groups.py


示例8: post

    def post(self, request, repo_group_id):
        """
        Dispatch a task to publish content from the repo group using the distributor specified by
        the params.

        :param request: WSGI request object
        :type  request: django.core.handlers.wsgi.WSGIRequest
        :param repo_group_id: repo group to publish
        :type  repo_group_id: str

        :raises pulp_exceptions.MissingValue if 'id' is not passed in the body
        :raises pulp_exceptions.OperationPosponed: dispatch a task
        """
        params = request.body_as_json
        distributor_id = params.get('id', None)
        overrides = params.get('override_config', None)
        if distributor_id is None:
            raise pulp_exceptions.MissingValue(['id'])
        # If a repo group does not exist, get_group raises a MissingResource exception
        manager = managers_factory.repo_group_query_manager()
        manager.get_group(repo_group_id)
        task_tags = [
            tags.resource_tag(tags.RESOURCE_REPOSITORY_GROUP_TYPE, repo_group_id),
            tags.resource_tag(tags.RESOURCE_REPOSITORY_GROUP_DISTRIBUTOR_TYPE, distributor_id),
            tags.action_tag('publish')
        ]
        async_result = repo_group_publish.apply_async_with_reservation(
            tags.RESOURCE_REPOSITORY_GROUP_TYPE,
            repo_group_id,
            args=[repo_group_id, distributor_id],
            kwargs={'publish_config_override': overrides},
            tags=task_tags
        )
        raise pulp_exceptions.OperationPostponed(async_result)
开发者ID:jeremycline,项目名称:pulp,代码行数:34,代码来源:repo_groups.py


示例9: test_bind

    def test_bind(self, *mocks):

        mock_agent = mocks[0]
        mock_context = mocks[1]
        mock_factory = mocks[2]
        mock_bindings = mocks[3]
        mock_task_status = mocks[4]
        mock_uuid = mocks[5]

        consumer = {'id': '1234'}
        mock_consumer_manager = Mock()
        mock_consumer_manager.get_consumer = Mock(return_value=consumer)
        mock_factory.consumer_manager = Mock(return_value=mock_consumer_manager)

        binding = {}
        mock_bind_manager = Mock()
        mock_bind_manager.get_bind = Mock(return_value=binding)
        mock_bind_manager.action_pending = Mock()
        mock_factory.consumer_bind_manager = Mock(return_value=mock_bind_manager)

        agent_bindings = []
        mock_bindings.return_value = agent_bindings

        task_id = '2345'
        mock_context.return_value = {}
        mock_uuid.return_value = task_id

        # test manager

        repo_id = '100'
        distributor_id = '200'
        options = {}
        agent_manager = AgentManager()
        agent_manager.bind(consumer['id'], repo_id, distributor_id, options)

        # validations

        task_tags = [
            tags.resource_tag(tags.RESOURCE_CONSUMER_TYPE, consumer['id']),
            tags.resource_tag(tags.RESOURCE_REPOSITORY_TYPE, repo_id),
            tags.resource_tag(tags.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE, distributor_id),
            tags.action_tag(tags.ACTION_AGENT_BIND)
        ]

        mock_consumer_manager.get_consumer.assert_called_with(consumer['id'])
        mock_bind_manager.get_bind.assert_called_with(consumer['id'], repo_id, distributor_id)
        mock_bindings.assert_called_with([binding])

        mock_context.assert_called_with(
            consumer,
            task_id=task_id,
            action='bind',
            consumer_id=consumer['id'],
            repo_id=repo_id,
            distributor_id=distributor_id)

        mock_task_status.assert_called_with(task_id=task_id, worker_name='agent', tags=task_tags)
        mock_agent.bind.assert_called_with(mock_context.return_value, agent_bindings, options)
        mock_bind_manager.action_pending.assert_called_with(
            consumer['id'], repo_id, distributor_id, Bind.Action.BIND, task_id)
开发者ID:alanoe,项目名称:pulp,代码行数:60,代码来源:test_agent.py


示例10: PUT

    def PUT(self, consumer_id, content_type):
        """
        Update the association of a profile with a consumer by content type ID.
        @param consumer_id: A consumer ID.
        @type consumer_id: str
        @param content_type: A content unit type ID.
        @type content_type: str
        @return: The updated model object:
            {consumer_id:<str>, content_type:<str>, profile:<dict>}
        @rtype: dict
        """
        body = self.params()
        profile = body.get('profile')

        manager = managers.consumer_profile_manager()
        tags = [resource_tag(dispatch_constants.RESOURCE_CONSUMER_TYPE, consumer_id),
                resource_tag(dispatch_constants.RESOURCE_CONTENT_UNIT_TYPE, content_type),
                action_tag('profile_update')]

        call_request = CallRequest(manager.update,
                                   [consumer_id, content_type],
                                   {'profile': profile},
                                   tags=tags,
                                   weight=0,
                                   kwarg_blacklist=['profile'])
        call_request.reads_resource(dispatch_constants.RESOURCE_CONSUMER_TYPE, consumer_id)

        call_report = CallReport.from_call_request(call_request)
        call_report.serialize_result = False

        consumer = execution.execute_sync(call_request, call_report)
        link = serialization.link.child_link_obj(consumer_id, content_type)
        consumer.update(link)

        return self.ok(consumer)
开发者ID:graco,项目名称:pulp,代码行数:35,代码来源:consumers.py


示例11: PUT

    def PUT(self, repo_group_id, distributor_id):
        params = self.params()

        distributor_config = params.get('distributor_config', None)

        if distributor_config is None:
            raise pulp_exceptions.MissingValue(['distributor_config'])

        distributor_manager = managers_factory.repo_group_distributor_manager()

        resources = {
            dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE :
                    {repo_group_id : dispatch_constants.RESOURCE_UPDATE_OPERATION},
            dispatch_constants.RESOURCE_REPOSITORY_GROUP_DISTRIBUTOR_TYPE :
                    {distributor_id : dispatch_constants.RESOURCE_UPDATE_OPERATION},
            }
        tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE, repo_group_id),
                resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_DISTRIBUTOR_TYPE, distributor_id),
                action_tag('update_distributor')
        ]

        call_request = CallRequest(distributor_manager.update_distributor_config,
                                   args=[repo_group_id, distributor_id, distributor_config],
                                   resources=resources,
                                   tags=tags,
                                   archive=True)

        result = execution.execute(call_request)

        href = serialization.link.current_link_obj()
        result.update(href)

        return self.ok(result)
开发者ID:stpierre,项目名称:pulp,代码行数:33,代码来源:repo_groups.py


示例12: POST

    def POST(self, repo_group_id):
        params = self.params()
        distributor_id = params.get('id', None)
        overrides = params.get('override_config', None)

        if distributor_id is None:
            raise MissingValue(['id'])

        publish_manager = managers_factory.repo_group_publish_manager()

        resources = {
            dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE :
                    {repo_group_id : dispatch_constants.RESOURCE_UPDATE_OPERATION},
            dispatch_constants.RESOURCE_REPOSITORY_GROUP_DISTRIBUTOR_TYPE :
                    {distributor_id : dispatch_constants.RESOURCE_UPDATE_OPERATION},
            }
        tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE, repo_group_id),
                resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_DISTRIBUTOR_TYPE, distributor_id),
                action_tag('publish')
        ]
        weight = pulp_config.config.getint('tasks', 'publish_weight')

        call_request = CallRequest(publish_manager.publish,
                                   args=[repo_group_id, distributor_id],
                                   kwargs={'publish_config_override' : overrides},
                                   resources=resources,
                                   tags=tags,
                                   weight=weight,
                                   archive=True)

        return execution.execute_async(self, call_request)
开发者ID:stpierre,项目名称:pulp,代码行数:31,代码来源:repo_groups.py


示例13: DELETE

    def DELETE(self, repo_group_id, distributor_id):
        params = self.params()
        force = params.get('force', False)

        distributor_manager = managers_factory.repo_group_distributor_manager()

        resources = {
            dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE :
                    {repo_group_id : dispatch_constants.RESOURCE_UPDATE_OPERATION},
            dispatch_constants.RESOURCE_REPOSITORY_GROUP_DISTRIBUTOR_TYPE :
                    {distributor_id : dispatch_constants.RESOURCE_DELETE_OPERATION},
                     }
        tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE, repo_group_id),
                resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_DISTRIBUTOR_TYPE, distributor_id),
                action_tag('remove_distributor')
               ]
        call_request = CallRequest(distributor_manager.remove_distributor,
                                   args=[repo_group_id, distributor_id],
                                   kwargs={'force' : force},
                                   resources=resources,
                                   tags=tags,
                                   archive=True)

        execution.execute(call_request)
        return self.ok(None)
开发者ID:stpierre,项目名称:pulp,代码行数:25,代码来源:repo_groups.py


示例14: create_sync_schedule

    def create_sync_schedule(self, repo_id, importer_id, sync_options, schedule_data):
        """
        Create a new sync schedule for a given repository using the given importer.
        @param repo_id:
        @param importer_id:
        @param sync_options:
        @param schedule_data:
        @return:
        """

        # validate the input
        self._validate_importer(repo_id, importer_id)
        self._validate_keys(sync_options, _SYNC_OPTION_KEYS)
        if 'schedule' not in schedule_data:
            raise pulp_exceptions.MissingValue(['schedule'])

        # build the sync call request
        sync_manager = managers_factory.repo_sync_manager()
        args = [repo_id]
        kwargs = {'sync_config_override': sync_options['override_config']}
        weight = pulp_config.config.getint('tasks', 'sync_weight')
        tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id),
                resource_tag(dispatch_constants.RESOURCE_REPOSITORY_IMPORTER_TYPE, importer_id)]
        call_request = CallRequest(sync_manager.sync, args, kwargs, weight=weight, tags=tags, archive=True)
        call_request.reads_resource(dispatch_constants.RESOURCE_REPOSITORY_IMPORTER_TYPE, importer_id)
        call_request.updates_resource(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id)
        call_request.add_life_cycle_callback(dispatch_constants.CALL_ENQUEUE_LIFE_CYCLE_CALLBACK, sync_manager.prep_sync)

        # schedule the sync
        scheduler = dispatch_factory.scheduler()
        schedule_id = scheduler.add(call_request, **schedule_data)
        importer_manager = managers_factory.repo_importer_manager()
        importer_manager.add_sync_schedule(repo_id, schedule_id)
        return schedule_id
开发者ID:ehelms,项目名称:pulp,代码行数:34,代码来源:cud.py


示例15: queue_update

def queue_update(distributor, config, delta):
    """
    Dispatch a task to update a distributor.

    :param distributor: distributor to be updated
    :type  distributor: pulp.server.db.model.Distributor
    :param config: A configuration dictionary for a distributor instance. The contents of this dict
                   depends on the type of distributor. Values of None will remove they key from the
                   config. Keys ommited from this dictionary will remain unchanged.
    :type  config: dict
    :param delta: A dictionary used to change conf values for a distributor instance. This currently
                  only supports the 'auto_publish' keyword, which should have a value of type bool
    :type  delta: dict or None

    :return: An AsyncResult instance as returned by Celery's apply_async
    :rtype:  celery.result.AsyncResult
    """
    task_tags = [
        tags.resource_tag(tags.RESOURCE_REPOSITORY_TYPE, distributor.repo_id),
        tags.resource_tag(tags.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE, distributor.distributor_id),
        tags.action_tag('update_distributor')
    ]
    async_result = update.apply_async_with_reservation(
        tags.RESOURCE_REPOSITORY_TYPE, distributor.repo_id,
        [distributor.repo_id, distributor.distributor_id, config, delta],
        tags=task_tags)
    return async_result
开发者ID:maxamillion,项目名称:pulp,代码行数:27,代码来源:distributor.py


示例16: POST

    def POST(self, repo_id):

        # Params (validation will occur in the manager)
        params = self.params()
        distributor_type = params.get('distributor_type_id', None)
        distributor_config = params.get('distributor_config', None)
        distributor_id = params.get('distributor_id', None)
        auto_publish = params.get('auto_publish', False)

        # Update the repo
        distributor_manager = manager_factory.repo_distributor_manager()

        resources = {dispatch_constants.RESOURCE_REPOSITORY_TYPE: {repo_id: dispatch_constants.RESOURCE_UPDATE_OPERATION}}
        weight = pulp_config.config.getint('tasks', 'create_weight')
        tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id),
                action_tag('add_distributor')]
        if distributor_id is not None:
            resources.update({dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE: {distributor_id: dispatch_constants.RESOURCE_CREATE_OPERATION}})
            tags.append(resource_tag(dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE, distributor_id))
        call_request = CallRequest(distributor_manager.add_distributor,
                                   [repo_id, distributor_type, distributor_config, auto_publish, distributor_id],
                                   resources=resources,
                                   weight=weight,
                                   tags=tags)
        return execution.execute_created(self, call_request, distributor_id)
开发者ID:ryanschneider,项目名称:pulp,代码行数:25,代码来源:repositories.py


示例17: PUT

    def PUT(self, repo_id, importer_id):

        # Params (validation will occur in the manager)
        params = self.params()
        importer_config = params.get('importer_config', None)

        if importer_config is None:
            _LOG.error('Missing configuration updating importer for repository [%s]' % repo_id)
            raise exceptions.MissingValue(['importer_config'])

        importer_manager = manager_factory.repo_importer_manager()
        resources = {dispatch_constants.RESOURCE_REPOSITORY_TYPE: {repo_id: dispatch_constants.RESOURCE_UPDATE_OPERATION},
                     dispatch_constants.RESOURCE_REPOSITORY_IMPORTER_TYPE: {importer_id: dispatch_constants.RESOURCE_UPDATE_OPERATION}}
        tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id),
                resource_tag(dispatch_constants.RESOURCE_REPOSITORY_IMPORTER_TYPE, importer_id),
                action_tag('update_importer')]
        call_request = CallRequest(importer_manager.update_importer_config,
                                   [repo_id],
                                   {'importer_config': importer_config},
                                   resources=resources,
                                   tags=tags,
                                   archive=True,
                                   kwarg_blacklist=['importer_config'])
        result = execution.execute(call_request)
        return self.ok(result)
开发者ID:domcleal,项目名称:pulp,代码行数:25,代码来源:repositories.py


示例18: POST

    def POST(self, repo_id):

        # Params (validation will occur in the manager)
        params = self.params()
        distributor_type = params.get('distributor_type_id', None)
        distributor_config = params.get('distributor_config', None)
        distributor_id = params.get('distributor_id', None)
        auto_publish = params.get('auto_publish', False)

        # Update the repo
        distributor_manager = manager_factory.repo_distributor_manager()

        weight = pulp_config.config.getint('tasks', 'create_weight')
        tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id),
                action_tag('add_distributor')]
        if distributor_id is not None:
            tags.append(resource_tag(dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE, distributor_id))
        call_request = CallRequest(distributor_manager.add_distributor,
                                   [repo_id, distributor_type],
                                   {'repo_plugin_config': distributor_config, 'auto_publish': auto_publish,
                                    'distributor_id': distributor_id},
                                   weight=weight,
                                   tags=tags,
                                   kwarg_blacklist=['repo_plugin_config'])
        call_request.updates_resource(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id)
        if distributor_id is not None:
            call_request.creates_resource(dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE, distributor_id)
        return execution.execute_created(self, call_request, distributor_id)
开发者ID:hennessy80,项目名称:pulp,代码行数:28,代码来源:repositories.py


示例19: PUT

    def PUT(self, repo_id, importer_id, schedule_id):
        importer_manager = manager_factory.repo_importer_manager()
        schedule_list = importer_manager.list_sync_schedules(repo_id)
        if schedule_id not in schedule_list:
            raise exceptions.MissingResource(repo=repo_id, importer=importer_id, publish_schedule=schedule_id)

        sync_updates = {}
        schedule_updates = self.params()
        if 'override_config' in schedule_updates:
            sync_updates['override_config'] = schedule_updates.pop('override_config')

        schedule_manager = manager_factory.schedule_manager()
        tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id),
                resource_tag(dispatch_constants.RESOURCE_REPOSITORY_IMPORTER_TYPE, importer_id),
                resource_tag(dispatch_constants.RESOURCE_SCHEDULE_TYPE, schedule_id),
                action_tag('update_sync_schedule')]
        call_request = CallRequest(schedule_manager.update_sync_schedule,
                                   [repo_id, importer_id, schedule_id, sync_updates, schedule_updates],
                                   tags=tags,
                                   archive=True)
        call_request.reads_resource(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id)
        call_request.reads_resource(dispatch_constants.RESOURCE_REPOSITORY_IMPORTER_TYPE, importer_id)
        call_request.updates_resource(dispatch_constants.RESOURCE_SCHEDULE_TYPE, schedule_id)
        execution.execute(call_request)

        scheduler = dispatch_factory.scheduler()
        schedule = scheduler.get(schedule_id)
        obj = serialization.dispatch.scheduled_sync_obj(schedule)
        obj.update(serialization.link.current_link_obj())
        return self.ok(obj)
开发者ID:hennessy80,项目名称:pulp,代码行数:30,代码来源:repositories.py


示例20: PUT

    def PUT(self, repo_id, distributor_id, schedule_id):
        distributor_manager = manager_factory.repo_distributor_manager()
        schedule_list = distributor_manager.list_publish_schedules(repo_id, distributor_id)
        if schedule_id not in schedule_list:
            raise exceptions.MissingResource(repo=repo_id, distributor=distributor_id, publish_schedule=schedule_id)

        publish_update = {}
        schedule_update = self.params()
        if 'override_config' in schedule_update:
            publish_update['override_config'] = schedule_update.pop('override_config')

        schedule_manager = manager_factory.schedule_manager()
        resources = {dispatch_constants.RESOURCE_REPOSITORY_TYPE: {repo_id: dispatch_constants.RESOURCE_READ_OPERATION},
                     dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE: {distributor_id: dispatch_constants.RESOURCE_READ_OPERATION},
                     dispatch_constants.RESOURCE_SCHEDULE_TYPE: {schedule_id: dispatch_constants.RESOURCE_UPDATE_OPERATION}}
        tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id),
                resource_tag(dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE, distributor_id),
                resource_tag(dispatch_constants.RESOURCE_SCHEDULE_TYPE, schedule_id),
                action_tag('update_publish_schedule')]
        call_request = CallRequest(schedule_manager.update_publish_schedule,
                                   [repo_id, distributor_id, schedule_id, publish_update, schedule_update],
                                   resources=resources,
                                   tags=tags,
                                   archive=True)
        execution.execute(call_request)

        scheduler = dispatch_factory.scheduler()
        schedule = scheduler.get(schedule_id)
        obj = serialization.dispatch.scheduled_publish_obj(schedule)
        obj.update(serialization.link.current_link_obj())
        return self.ok(obj)
开发者ID:ryanschneider,项目名称:pulp,代码行数:31,代码来源:repositories.py



注:本文中的pulp.common.tags.resource_tag函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.encode_unicode函数代码示例发布时间:2022-05-25
下一篇:
Python tags.action_tag函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap