Пример #1
0
    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)
Пример #2
0
    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)
Пример #3
0
    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)
Пример #4
0
    def setUp(self):
        super(RepoGroupPublishManagerTests, self).setUp()
        mock_plugins.install()

        self.group_manager = manager_factory.repo_group_manager()
        self.distributor_manager = manager_factory.repo_group_distributor_manager()
        self.publish_manager = manager_factory.repo_group_publish_manager()

        self.group_id = 'publish-group'
        self.group_manager.create_repo_group(self.group_id)

        self.distributor_id = 'publish-dist'
        self.distributor_manager.add_distributor(self.group_id, 'mock-group-distributor', {}, distributor_id=self.distributor_id)
Пример #5
0
    def last_publish(self):
        """
        Returns the timestamp of the last time this repository group was
        publishe, regardless of the success or failure of the publish. If
        the group was never published, this call returns None.

        @return: timestamp describing the last publish
        @rtype:  datetime
        """
        try:
            manager = manager_factory.repo_group_publish_manager()
            last = manager.last_publish(self.group_id, self.distributor_id)
            return last
        except Exception, e:
            _logger.exception('Error getting last publish time for group [%s]' % self.group_id)
            raise DistributorConduitException(e), None, sys.exc_info()[2]
Пример #6
0
    def last_publish(self):
        """
        Returns the timestamp of the last time this repository group was
        publishe, regardless of the success or failure of the publish. If
        the group was never published, this call returns None.

        @return: timestamp describing the last publish
        @rtype:  datetime
        """
        try:
            manager = manager_factory.repo_group_publish_manager()
            last = manager.last_publish(self.group_id, self.distributor_id)
            return last
        except Exception, e:
            _LOG.exception('Error getting last publish time for group [%s]' % self.group_id)
            raise DistributorConduitException(e), None, sys.exc_info()[2]