コード例 #1
0
    def post(self, namespace, repository):
        """
        Change the visibility of a repository.
        """
        if not model.repo_exists(namespace, repository):
            raise NotFound()

        tags, _ = tuf_metadata_api.get_default_tags_with_expiration(
            namespace, repository)
        if tags and not tuf_metadata_api.delete_metadata(
                namespace, repository):
            raise DownstreamIssue("Unable to delete downstream trust metadata")

        values = request.get_json()
        model.set_trust(namespace, repository, values["trust_enabled"])

        log_action(
            "change_repo_trust",
            namespace,
            {
                "repo": repository,
                "namespace": namespace,
                "trust_enabled": values["trust_enabled"]
            },
            repo_name=repository,
        )

        return {"success": True}
コード例 #2
0
ファイル: repository.py プロジェクト: xzwupeng/quay
    def post(self, namespace, repository):
        """ Change the visibility of a repository. """
        if not model.repo_exists(namespace, repository):
            raise NotFound()

        tags, _ = tuf_metadata_api.get_default_tags_with_expiration(
            namespace, repository)
        if tags and not tuf_metadata_api.delete_metadata(
                namespace, repository):
            raise DownstreamIssue('Unable to delete downstream trust metadata')

        values = request.get_json()
        model.set_trust(namespace, repository, values['trust_enabled'])

        log_action('change_repo_trust',
                   namespace, {
                       'repo': repository,
                       'namespace': namespace,
                       'trust_enabled': values['trust_enabled']
                   },
                   repo_name=repository)

        return {'success': True}