mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andsc...@apache.org
Subject mesos git commit: Windows: Fixed location of Docker's `config.json` file.
Date Fri, 02 Mar 2018 00:20:43 GMT
Repository: mesos
Updated Branches:
  refs/heads/master b29677d1a -> 9bd5d8f9b


Windows: Fixed location of Docker's `config.json` file.

Per MESOS-8619, Docker checks `$USERPROFILE/.docker/config.json`
instead of `$HOME`. Mesos overrides this environment variable in order
to point Docker to a `config.json` file in another location, so we
have to fix the assumption we made about Docker.

We do not add this constant to stout, because it is not consistent
across Windows applications. This particular logic is specific to the
implementation of Docker. Other applications might check `$HOME` or
`$HOMEPATH` on Windows.

Review: https://reviews.apache.org/r/65872


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/9bd5d8f9
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/9bd5d8f9
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/9bd5d8f9

Branch: refs/heads/master
Commit: 9bd5d8f9bb95dce9bab199840d0ccd37e845a95b
Parents: b29677d
Author: Andrew Schwartzmeyer <andrew@schwartzmeyer.com>
Authored: Wed Feb 28 16:45:49 2018 -0800
Committer: Andrew Schwartzmeyer <andrew@schwartzmeyer.com>
Committed: Thu Mar 1 16:20:37 2018 -0800

----------------------------------------------------------------------
 src/docker/docker.cpp | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/9bd5d8f9/src/docker/docker.cpp
----------------------------------------------------------------------
diff --git a/src/docker/docker.cpp b/src/docker/docker.cpp
index 876dfff..9dd4ceb 100644
--- a/src/docker/docker.cpp
+++ b/src/docker/docker.cpp
@@ -1729,10 +1729,19 @@ Future<Docker::Image> Docker::__pull(
   // provided which is a docker config file we want docker to be
   // able to pick it up from the sandbox directory where we store
   // all the URI downloads.
+  //
+  // NOTE: On Windows, Docker users $USERPROFILE instead of $HOME.
+  // See MESOS-8619 for more details.
+  //
   // TODO(gilbert): Deprecate the fetching docker config file
   // specified as URI method on 0.30.0 release.
+#ifdef __WINDOWS__
+  const std::string HOME = "USERPROFILE";
+#else
+  const std::string HOME = "HOME";
+#endif // __WINDOWS__
   map<string, string> environment = os::environment();
-  environment["HOME"] = directory;
+  environment[HOME] = directory;
 
   bool configExisted =
     os::exists(path::join(directory, ".docker", "config.json")) ||
@@ -1743,7 +1752,7 @@ Future<Docker::Image> Docker::__pull(
   // and another docker config file is specified using the
   // '--docker_config' agent flag.
   if (!configExisted && home.isSome()) {
-    environment["HOME"] = home.get();
+    environment[HOME] = home.get();
   }
 
   Try<Subprocess> s_ = subprocess(


Mime
View raw message