def manifest(self, validate=True): """Override.""" # GET server1/v2/<name>/manifests/<tag_or_digest> if isinstance(self._name, docker_name.Tag): return self._content('manifests/' + self._name.tag).decode('utf8') else: assert isinstance(self._name, docker_name.Digest) c = self._content('manifests/' + self._name.digest).decode('utf8') # v2 removes signatures to compute the manifest digest, this is hard. computed = docker_digest.SignedManifestToSHA256(c) if validate and computed != self._name.digest: raise DigestMismatchedError( 'The returned manifest\'s digest did not match requested digest, ' '%s vs. %s' % (self._name.digest, computed)) return c
def digest(self): """The digest of the manifest.""" return docker_digest.SignedManifestToSHA256(self.manifest())