Skip to content

Instantly share code, notes, and snippets.

@tnachen
Created November 6, 2015 17:44
Show Gist options
  • Save tnachen/aae0b9713c1a35a6418b to your computer and use it in GitHub Desktop.
Save tnachen/aae0b9713c1a35a6418b to your computer and use it in GitHub Desktop.
Patch ontop of 39340
diff --git a/src/slave/containerizer/mesos/provisioner/docker/registry_client.cpp b/src/slave/containerizer/mesos/provisioner/docker/registry_client.cpp
index 10c5e7a..29d4d4d 100644
--- a/src/slave/containerizer/mesos/provisioner/docker/registry_client.cpp
+++ b/src/slave/containerizer/mesos/provisioner/docker/registry_client.cpp
@@ -672,12 +672,13 @@ Future<size_t> RegistryClientProcess::getBlob(
return Failure("Invalid repository path: " + path);
}
+ const string blobURLPath = "v2/" + path + "/blobs/" + digest.getOrElse("");
+
http::URL blobURL(registryServer_);
- blobURL.path =
- "v2/" + path + "/blobs/" + digest.getOrElse("");
+ blobURL.path = blobURLPath;
return doHttpGet(blobURL, None(), true, true, None())
- .then([this, path, digest, filePath](
+ .then([this, blobURLPath, digest, filePath](
const http::Response& response) -> Future<size_t> {
Try<int> fd = os::open(
filePath.value,
@@ -706,35 +707,24 @@ Future<size_t> RegistryClientProcess::getBlob(
size_t totalSize = 0;
return saveBlob(fd.get(), reader.get(), totalSize)
- .onAny([path, digest, filePath, fd](
+ .onAny([blobURLPath, digest, filePath, fd](
const Future<size_t>& future) {
Try<Nothing> close = os::close(fd.get());
if (close.isError()) {
LOG(WARNING) << "Failed to close the file descriptor for blob '"
- << string(filePath)
- << "': "
- << close.error();
+ << stringify(filePath) << "': " << close.error();
}
if (future.isFailed()) {
- LOG(WARNING) << "Failed to save blob '"
- << path
- << "@"
- << digest.get()
- << " to path '"
- << string(filePath)
- << "': "
- << future.failure();
+ LOG(WARNING) << "Failed to save blob requested from '"
+ << blobURLPath << "' to path '"
+ << stringify(filePath) << "': " << future.failure();
}
if (future.isDiscarded()) {
- LOG(WARNING) << "Failed to save blob '"
- << path
- << "@"
- << digest.get()
- << " to path '"
- << string(filePath)
- << ": future discarded";
+ LOG(WARNING) << "Failed to save blob requested from '"
+ << blobURLPath << "' to path '" << stringify(filePath)
+ << "': future discarded";
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment