This is an automated email from the ASF dual-hosted git repository.

bennoe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit e31a25131ee345792ceda37354bc824bf038bc1c
Author: Benjamin Bannier <[email protected]>
AuthorDate: Tue Jan 7 13:19:15 2020 +0100

    Renamed stout's path-related absolute functions to is_absolute.
    
    Review: https://reviews.apache.org/r/71880/
---
 src/docker/docker.cpp                                        | 12 ++++++------
 src/hdfs/hdfs.cpp                                            |  2 +-
 src/resource_provider/storage/uri_disk_profile_adaptor.hpp   |  2 +-
 src/slave/container_loggers/logrotate.hpp                    |  2 +-
 src/slave/containerizer/fetcher.cpp                          |  2 +-
 .../containerizer/mesos/isolators/docker/volume/isolator.cpp |  2 +-
 src/slave/containerizer/mesos/isolators/filesystem/linux.cpp |  4 ++--
 src/slave/containerizer/mesos/isolators/posix/disk.cpp       |  2 +-
 src/slave/containerizer/mesos/isolators/volume/host_path.cpp |  6 +++---
 src/slave/containerizer/mesos/isolators/volume/image.cpp     |  2 +-
 .../containerizer/mesos/isolators/volume/sandbox_path.cpp    | 10 +++++-----
 src/slave/containerizer/mesos/isolators/volume/secret.cpp    |  2 +-
 src/slave/containerizer/mesos/launch.cpp                     |  2 +-
 src/slave/paths.cpp                                          |  4 ++--
 src/tests/storage_local_resource_provider_tests.cpp          | 12 ++++++------
 src/uri/fetchers/docker.cpp                                  |  2 +-
 16 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/src/docker/docker.cpp b/src/docker/docker.cpp
index d13869d..04fb8d0 100644
--- a/src/docker/docker.cpp
+++ b/src/docker/docker.cpp
@@ -127,7 +127,7 @@ Try<Owned<Docker>> Docker::create(
   // on Windows an empty value of `socket` is frequently used to connect to the
   // Docker host (i.e., the user wants to connect 'npipes://', with an empty
   // socket path). A full solution should accommodate this.
-  if (!path::absolute(socket)) {
+  if (!path::is_absolute(socket)) {
     return Error("Invalid Docker socket path: " + socket);
   }
 #endif // __WINDOWS__
@@ -694,7 +694,7 @@ Try<Docker::RunOptions> Docker::RunOptions::create(
     // The 'container_path' can be either an absolute path or a
     // relative path. If it is a relative path, it would be prefixed
     // with the container sandbox directory.
-    string volumeConfig = path::absolute(volume.container_path())
+    string volumeConfig = path::is_absolute(volume.container_path())
       ? volume.container_path()
       : path::join(mappedDirectory, volume.container_path());
 
@@ -703,15 +703,15 @@ Try<Docker::RunOptions> Docker::RunOptions::create(
       // If both 'host_path' and 'container_path' are relative paths,
       // return a failure because the user can just directly access the
       // volume in the sandbox.
-      if (!path::absolute(volume.host_path()) &&
-          !path::absolute(volume.container_path())) {
+      if (!path::is_absolute(volume.host_path()) &&
+          !path::is_absolute(volume.container_path())) {
         return Error(
             "Both host_path '" + volume.host_path() + "' " +
             "and container_path '" + volume.container_path() + "' " +
             "of a volume are relative");
       }
 
-      if (!path::absolute(volume.host_path()) &&
+      if (!path::is_absolute(volume.host_path()) &&
           !dockerInfo.has_volume_driver()) {
         // When volume driver is empty and host path is a relative path, 
mapping
         // host path from the sandbox.
@@ -1117,7 +1117,7 @@ Future<Option<int>> Docker::run(
   }
 
   foreach (const Device& device, options.devices) {
-    if (!device.hostPath.absolute()) {
+    if (!device.hostPath.is_absolute()) {
       return Failure("Device path '" + device.hostPath.string() + "'"
                      " is not an absolute path");
     }
diff --git a/src/hdfs/hdfs.cpp b/src/hdfs/hdfs.cpp
index 3947b69..1216e08 100644
--- a/src/hdfs/hdfs.cpp
+++ b/src/hdfs/hdfs.cpp
@@ -199,7 +199,7 @@ Try<mesos::URI> HDFS::parse(const string& uri)
 static string normalize(const string& hdfsPath)
 {
   if (strings::contains(hdfsPath, "://") || // A URI or a malformed path.
-      path::absolute(hdfsPath)) { // Already an absolute path.
+      path::is_absolute(hdfsPath)) { // Already an absolute path.
     return hdfsPath;
   }
 
diff --git a/src/resource_provider/storage/uri_disk_profile_adaptor.hpp 
b/src/resource_provider/storage/uri_disk_profile_adaptor.hpp
index 027ceaa..13a37b3 100644
--- a/src/resource_provider/storage/uri_disk_profile_adaptor.hpp
+++ b/src/resource_provider/storage/uri_disk_profile_adaptor.hpp
@@ -132,7 +132,7 @@ public:
             }
 
             // We only allow absolute paths for file paths.
-            if (!value.absolute()) {
+            if (!value.is_absolute()) {
               return Error("--uri to a file must be an absolute path");
             }
 
diff --git a/src/slave/container_loggers/logrotate.hpp 
b/src/slave/container_loggers/logrotate.hpp
index c6dbd61..971b876 100644
--- a/src/slave/container_loggers/logrotate.hpp
+++ b/src/slave/container_loggers/logrotate.hpp
@@ -88,7 +88,7 @@ struct Flags : public virtual flags::FlagsBase
             return Error("Missing required option --log_filename");
           }
 
-          if (!path::absolute(value.get())) {
+          if (!path::is_absolute(value.get())) {
             return Error("Expected --log_filename to be an absolute path");
           }
 
diff --git a/src/slave/containerizer/fetcher.cpp 
b/src/slave/containerizer/fetcher.cpp
index 3a5a74b..87bba8d 100644
--- a/src/slave/containerizer/fetcher.cpp
+++ b/src/slave/containerizer/fetcher.cpp
@@ -200,7 +200,7 @@ Result<string> Fetcher::uriToLocalPath(
   string path =
     strings::remove(path::from_uri(uri), "localhost", strings::PREFIX);
 
-  if (!path::absolute(path)) {
+  if (!path::is_absolute(path)) {
     if (fileUri) {
       return Error("File URI only supports absolute paths");
     }
diff --git a/src/slave/containerizer/mesos/isolators/docker/volume/isolator.cpp 
b/src/slave/containerizer/mesos/isolators/docker/volume/isolator.cpp
index e4a19c4..c547696 100644
--- a/src/slave/containerizer/mesos/isolators/docker/volume/isolator.cpp
+++ b/src/slave/containerizer/mesos/isolators/docker/volume/isolator.cpp
@@ -420,7 +420,7 @@ Future<Option<ContainerLaunchInfo>> 
DockerVolumeIsolatorProcess::prepare(
     // a dependency on that isolator, and it assumes that if the
     // container specifies a rootfs the sandbox is already bind
     // mounted into the container.
-    if (path::absolute(_volume.container_path())) {
+    if (path::is_absolute(_volume.container_path())) {
       // To specify a docker volume for a container, operators should
       // be allowed to define the 'container_path' either as an absolute
       // path or a relative path. Please see linux filesystem isolator
diff --git a/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp 
b/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp
index ab19230..0819738 100644
--- a/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp
+++ b/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp
@@ -750,7 +750,7 @@ Future<Option<ContainerLaunchInfo>> 
LinuxFilesystemIsolatorProcess::prepare(
 
     foreach (const ContainerMountInfo& mnt, ROOTFS_CONTAINER_MOUNTS) {
       // The target for special mounts must always be an absolute path.
-      CHECK(path::absolute(mnt.target()));
+      CHECK(path::is_absolute(mnt.target()));
 
       ContainerMountInfo* info = launchInfo.add_mounts();
 
@@ -758,7 +758,7 @@ Future<Option<ContainerLaunchInfo>> 
LinuxFilesystemIsolatorProcess::prepare(
       info->set_target(path::join(containerConfig.rootfs(), mnt.target()));
 
       // Absolute path mounts are always relative to the container root.
-      if (mnt.has_source() && path::absolute(mnt.source())) {
+      if (mnt.has_source() && path::is_absolute(mnt.source())) {
         info->set_source(path::join(containerConfig.rootfs(), info->source()));
       }
     }
diff --git a/src/slave/containerizer/mesos/isolators/posix/disk.cpp 
b/src/slave/containerizer/mesos/isolators/posix/disk.cpp
index 4d8047b..842facf 100644
--- a/src/slave/containerizer/mesos/isolators/posix/disk.cpp
+++ b/src/slave/containerizer/mesos/isolators/posix/disk.cpp
@@ -252,7 +252,7 @@ Future<Nothing> PosixDiskIsolatorProcess::update(
       // In case the path in the protobuf is not an absolute path it
       // is relative to the working directory of the executor. We
       // always store the absolute path.
-      if (!path::absolute(path)) {
+      if (!path::is_absolute(path)) {
         path = path::join(info->sandbox, path);
       }
     }
diff --git a/src/slave/containerizer/mesos/isolators/volume/host_path.cpp 
b/src/slave/containerizer/mesos/isolators/volume/host_path.cpp
index a20f7ac..0159b38 100644
--- a/src/slave/containerizer/mesos/isolators/volume/host_path.cpp
+++ b/src/slave/containerizer/mesos/isolators/volume/host_path.cpp
@@ -144,7 +144,7 @@ Future<Option<ContainerLaunchInfo>> 
VolumeHostPathIsolatorProcess::prepare(
     // 'host_path' can be relative in legacy mode, representing
     // SANDBOX_PATH volumes.
     if (volume.has_host_path() &&
-        path::absolute(volume.host_path())) {
+        path::is_absolute(volume.host_path())) {
       hostPath = volume.host_path();
     }
 
@@ -156,7 +156,7 @@ Future<Option<ContainerLaunchInfo>> 
VolumeHostPathIsolatorProcess::prepare(
       const Volume::Source::HostPath& hostPathInfo =
         volume.source().host_path();
 
-      if (!path::absolute(hostPathInfo.path())) {
+      if (!path::is_absolute(hostPathInfo.path())) {
         return Failure(
             "Path '" + hostPathInfo.path() + "' "
             "in HOST_PATH volume is not absolute");
@@ -211,7 +211,7 @@ Future<Option<ContainerLaunchInfo>> 
VolumeHostPathIsolatorProcess::prepare(
     // Determine the mount point for the host volume.
     string mountPoint;
 
-    if (path::absolute(volume.container_path())) {
+    if (path::is_absolute(volume.container_path())) {
       // TODO(jieyu): We need to check that the mount point resolves
       // under 'rootfs' because a user can potentially use a container
       // path like '/../../abc'.
diff --git a/src/slave/containerizer/mesos/isolators/volume/image.cpp 
b/src/slave/containerizer/mesos/isolators/volume/image.cpp
index b111252..c9d7984 100644
--- a/src/slave/containerizer/mesos/isolators/volume/image.cpp
+++ b/src/slave/containerizer/mesos/isolators/volume/image.cpp
@@ -143,7 +143,7 @@ Future<Option<ContainerLaunchInfo>> 
VolumeImageIsolatorProcess::prepare(
     // a dependency on that isolator, and it assumes that if the
     // container specifies a rootfs the sandbox is already bind
     // mounted into the container.
-    if (path::absolute(volume.container_path())) {
+    if (path::is_absolute(volume.container_path())) {
       // To specify an image volume for a container, operators should
       // be allowed to define the 'container_path' either as an absolute
       // path or a relative path. Please see linux filesystem isolator
diff --git a/src/slave/containerizer/mesos/isolators/volume/sandbox_path.cpp 
b/src/slave/containerizer/mesos/isolators/volume/sandbox_path.cpp
index 45bd143..fb625c1 100644
--- a/src/slave/containerizer/mesos/isolators/volume/sandbox_path.cpp
+++ b/src/slave/containerizer/mesos/isolators/volume/sandbox_path.cpp
@@ -169,7 +169,7 @@ Future<Option<ContainerLaunchInfo>> 
VolumeSandboxPathIsolatorProcess::prepare(
     // 'host_path' can be relative in legacy mode, representing
     // SANDBOX_PATH volumes.
     if (volume.has_host_path() &&
-        !path::absolute(volume.host_path())) {
+        !path::is_absolute(volume.host_path())) {
       sandboxPath = Volume::Source::SandboxPath();
       sandboxPath->set_type(Volume::Source::SandboxPath::SELF);
       sandboxPath->set_path(volume.host_path());
@@ -180,7 +180,7 @@ Future<Option<ContainerLaunchInfo>> 
VolumeSandboxPathIsolatorProcess::prepare(
         volume.source().type() == Volume::Source::SANDBOX_PATH) {
       CHECK(volume.source().has_sandbox_path());
 
-      if (path::absolute(volume.source().sandbox_path().path())) {
+      if (path::is_absolute(volume.source().sandbox_path().path())) {
         return Failure(
             "Path '" + volume.source().sandbox_path().path() + "' "
             "in SANDBOX_PATH volume is absolute");
@@ -199,7 +199,7 @@ Future<Option<ContainerLaunchInfo>> 
VolumeSandboxPathIsolatorProcess::prepare(
           "SANDBOX_PATH volume is not supported for DEBUG containers");
     }
 
-    if (!bindMountSupported && path::absolute(volume.container_path())) {
+    if (!bindMountSupported && path::is_absolute(volume.container_path())) {
       return Failure(
           "The 'linux' launcher and 'filesystem/linux' isolator "
           "must be enabled to support SANDBOX_PATH volume with "
@@ -222,7 +222,7 @@ Future<Option<ContainerLaunchInfo>> 
VolumeSandboxPathIsolatorProcess::prepare(
       case Volume::Source::SandboxPath::SELF:
         // NOTE: For this case, the user can simply create a symlink
         // in its sandbox. No need for a volume.
-        if (!path::absolute(volume.container_path())) {
+        if (!path::is_absolute(volume.container_path())) {
           return Failure(
               "'container_path' is relative for "
               "SANDBOX_PATH volume SELF type");
@@ -283,7 +283,7 @@ Future<Option<ContainerLaunchInfo>> 
VolumeSandboxPathIsolatorProcess::prepare(
     // Prepare the target.
     string target;
 
-    if (path::absolute(volume.container_path())) {
+    if (path::is_absolute(volume.container_path())) {
       CHECK(bindMountSupported);
 
       if (containerConfig.has_rootfs()) {
diff --git a/src/slave/containerizer/mesos/isolators/volume/secret.cpp 
b/src/slave/containerizer/mesos/isolators/volume/secret.cpp
index 91d7013..1d71434 100644
--- a/src/slave/containerizer/mesos/isolators/volume/secret.cpp
+++ b/src/slave/containerizer/mesos/isolators/volume/secret.cpp
@@ -187,7 +187,7 @@ Future<Option<ContainerLaunchInfo>> 
VolumeSecretIsolatorProcess::prepare(
     }
 
     string targetContainerPath;
-    if (path::absolute(volume.container_path())) {
+    if (path::is_absolute(volume.container_path())) {
       if (containerConfig.has_rootfs()) {
         targetContainerPath = path::join(
             containerConfig.rootfs(),
diff --git a/src/slave/containerizer/mesos/launch.cpp 
b/src/slave/containerizer/mesos/launch.cpp
index 1f8dc1a..2405e31 100644
--- a/src/slave/containerizer/mesos/launch.cpp
+++ b/src/slave/containerizer/mesos/launch.cpp
@@ -1175,7 +1175,7 @@ int MesosContainerizerLaunch::execute()
   // Search executable in the current working directory as well.
   // execvpe and execvp will only search executable from the current
   // working directory if environment variable PATH is not set.
-  if (!path::absolute(executable) &&
+  if (!path::is_absolute(executable) &&
       launchInfo.has_working_directory()) {
     Option<string> which = os::which(
         executable,
diff --git a/src/slave/paths.cpp b/src/slave/paths.cpp
index 5afcc7e..af2679f 100644
--- a/src/slave/paths.cpp
+++ b/src/slave/paths.cpp
@@ -742,7 +742,7 @@ string getPersistentVolumePath(
       CHECK(volume.disk().source().path().has_root());
       string root = volume.disk().source().path().root();
 
-      if (!path::absolute(root)) {
+      if (!path::is_absolute(root)) {
         // A relative path in `root` is relative to agent work dir.
         root = path::join(workDir, root);
       }
@@ -764,7 +764,7 @@ string getPersistentVolumePath(
       CHECK(volume.disk().source().mount().has_root());
       string root = volume.disk().source().mount().root();
 
-      if (!path::absolute(root)) {
+      if (!path::is_absolute(root)) {
         // A relative path in `root` is relative to agent work dir.
         root = path::join(workDir, root);
       }
diff --git a/src/tests/storage_local_resource_provider_tests.cpp 
b/src/tests/storage_local_resource_provider_tests.cpp
index d4a73c3..568683a 100644
--- a/src/tests/storage_local_resource_provider_tests.cpp
+++ b/src/tests/storage_local_resource_provider_tests.cpp
@@ -1030,7 +1030,7 @@ TEST_P(StorageLocalResourceProviderTest, 
CreateDestroyDisk)
 
   ASSERT_TRUE(created.disk().source().has_mount());
   ASSERT_TRUE(created.disk().source().mount().has_root());
-  EXPECT_FALSE(path::absolute(created.disk().source().mount().root()));
+  EXPECT_FALSE(path::is_absolute(created.disk().source().mount().root()));
 
   // Check if the volume is actually created by the test CSI plugin.
   const string& volumePath = created.disk().source().id();
@@ -1160,7 +1160,7 @@ TEST_P(StorageLocalResourceProviderTest, 
CreateDestroyDiskWithRecovery)
 
   ASSERT_TRUE(created.disk().source().has_mount());
   ASSERT_TRUE(created.disk().source().mount().has_root());
-  EXPECT_FALSE(path::absolute(created.disk().source().mount().root()));
+  EXPECT_FALSE(path::is_absolute(created.disk().source().mount().root()));
 
   // Check if the volume is actually created by the test CSI plugin.
   const string& volumePath = created.disk().source().id();
@@ -2301,7 +2301,7 @@ TEST_P(
 
   ASSERT_TRUE(created.disk().source().has_mount());
   ASSERT_TRUE(created.disk().source().mount().has_root());
-  EXPECT_FALSE(path::absolute(created.disk().source().mount().root()));
+  EXPECT_FALSE(path::is_absolute(created.disk().source().mount().root()));
 
   // Check if the CSI volume is actually created.
   const string& volumePath = created.disk().source().id();
@@ -3103,7 +3103,7 @@ TEST_P(
   ASSERT_TRUE(volume->disk().source().has_id());
   ASSERT_TRUE(volume->disk().source().has_mount());
   ASSERT_TRUE(volume->disk().source().mount().has_root());
-  EXPECT_FALSE(path::absolute(volume->disk().source().mount().root()));
+  EXPECT_FALSE(path::is_absolute(volume->disk().source().mount().root()));
 
   // Check if the volume is actually created by the test CSI plugin.
   const string& volumePath = volume->disk().source().id();
@@ -5060,7 +5060,7 @@ TEST_P(StorageLocalResourceProviderTest, 
OperationStateMetrics)
   ASSERT_TRUE(volume->disk().source().has_id());
   ASSERT_TRUE(volume->disk().source().has_mount());
   ASSERT_TRUE(volume->disk().source().mount().has_root());
-  EXPECT_FALSE(path::absolute(volume->disk().source().mount().root()));
+  EXPECT_FALSE(path::is_absolute(volume->disk().source().mount().root()));
 
   snapshot = Metrics();
 
@@ -5274,7 +5274,7 @@ TEST_P(StorageLocalResourceProviderTest, 
CsiPluginRpcMetrics)
   ASSERT_TRUE(volume->disk().source().has_id());
   ASSERT_TRUE(volume->disk().source().has_mount());
   ASSERT_TRUE(volume->disk().source().mount().has_root());
-  EXPECT_FALSE(path::absolute(volume->disk().source().mount().root()));
+  EXPECT_FALSE(path::is_absolute(volume->disk().source().mount().root()));
 
   // An additional `CreateVolume` RPC call is now finished.
   EXPECT_TRUE(metricEquals(
diff --git a/src/uri/fetchers/docker.cpp b/src/uri/fetchers/docker.cpp
index 1aa3def..75df80b 100644
--- a/src/uri/fetchers/docker.cpp
+++ b/src/uri/fetchers/docker.cpp
@@ -573,7 +573,7 @@ string DockerFetcherPlugin::getBlobPath(
 
   // The colon in disk designator is preserved.
   auto i = 0;
-  if (path::absolute(path)) {
+  if (path::is_absolute(path)) {
     i = path.find_first_of(':') + 1;
   }
 

Reply via email to