From 98cf52b699ce1eda07da9c61d97efa74ea46eadc Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 13 Jun 2013 09:41:19 -0400 Subject: [PATCH] Slave.remoteFS is intended to be an absolute path. (Could consider throwing IAE if it does not appear to be. Cannot easily call getRootPath().absolutize() since that requires a connection.) --- core/src/main/java/hudson/model/Slave.java | 6 +++++- core/src/main/resources/hudson/model/Messages.properties | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/model/Slave.java b/core/src/main/java/hudson/model/Slave.java index ff5ba010b9..7318f8bebe 100644 --- a/core/src/main/java/hudson/model/Slave.java +++ b/core/src/main/java/hudson/model/Slave.java @@ -91,7 +91,7 @@ public abstract class Slave extends Node implements Serializable { private final String description; /** - * Path to the root of the workspace + * Absolute path to the root of the workspace * from the view point of this node, such as "/hudson" */ protected final String remoteFS; @@ -412,6 +412,10 @@ public abstract class Slave extends Node implements Serializable { if(value.startsWith("\\\\") || value.startsWith("/net/")) return FormValidation.warning(Messages.Slave_Network_Mounted_File_System_Warning()); + if (!value.startsWith("\\") && !value.startsWith("/")) { + return FormValidation.error(Messages.Slave_the_remote_root_must_be_an_absolute_path()); + } + return FormValidation.ok(); } } diff --git a/core/src/main/resources/hudson/model/Messages.properties b/core/src/main/resources/hudson/model/Messages.properties index a8b311c048..96ddf87f98 100644 --- a/core/src/main/resources/hudson/model/Messages.properties +++ b/core/src/main/resources/hudson/model/Messages.properties @@ -242,6 +242,7 @@ Slave.Launching={0} Launching slave agent Slave.Network.Mounted.File.System.Warning=Are you sure you want to use network mounted file system for FS root? Note that this directory does not need to be visible to the master. Slave.Remote.Director.Mandatory=Remote directory is mandatory Slave.Terminated={0} slave agent was terminated +Slave.the_remote_root_must_be_an_absolute_path=The remote root must be an absolute path. Slave.UnableToLaunch=Unable to launch the slave agent for {0}{1} Slave.UnixSlave=This is a Unix slave Slave.WindowsSlave=This is a Windows slave