From 46f2f02f9dbea085e67ff70673f38644b14b4f01 Mon Sep 17 00:00:00 2001 From: Seiji Sogabe Date: Sat, 15 Jan 2011 21:18:19 +0900 Subject: [PATCH] [FIXED HUDSON-8438] Node names can be edited to include slashes and then cannot be removed. --- changelog.html | 3 ++ .../java/hudson/slaves/NodeDescriptor.java | 14 +++++--- .../hudson/slaves/Messages.properties | 3 +- .../hudson/slaves/Messages_ja.properties | 35 ++++++++++--------- 4 files changed, 33 insertions(+), 22 deletions(-) diff --git a/changelog.html b/changelog.html index 68d1ad8044..1e742b09e2 100644 --- a/changelog.html +++ b/changelog.html @@ -48,6 +48,9 @@ Upcoming changes (issue 8415)
  • Hudson was failing to record the connection termination problem in slave logs. +
  • + Node names can be edited to include slashes and then cannot be removed. + (issue 8437)
  • Startup performance improvement
  • diff --git a/core/src/main/java/hudson/slaves/NodeDescriptor.java b/core/src/main/java/hudson/slaves/NodeDescriptor.java index 2efc5c5b0a..084cfc6baf 100644 --- a/core/src/main/java/hudson/slaves/NodeDescriptor.java +++ b/core/src/main/java/hudson/slaves/NodeDescriptor.java @@ -33,6 +33,7 @@ import hudson.util.DescriptorList; import hudson.util.FormValidation; import hudson.DescriptorExtensionList; import hudson.Util; +import hudson.model.Failure; import java.io.IOException; import java.util.List; @@ -96,10 +97,15 @@ public abstract class NodeDescriptor extends Descriptor { } public FormValidation doCheckName(@QueryParameter String value ) { - if(Util.fixEmptyAndTrim(value)==null) - return FormValidation.error("Name is mandatory"); - else - return FormValidation.ok(); + String name = Util.fixEmptyAndTrim(value); + if(name==null) + return FormValidation.error(Messages.NodeDescripter_CheckName_Mandatory()); + try { + Hudson.checkGoodName(name); + } catch (Failure f) { + return FormValidation.error(f.getMessage()); + } + return FormValidation.ok(); } /** diff --git a/core/src/main/resources/hudson/slaves/Messages.properties b/core/src/main/resources/hudson/slaves/Messages.properties index c328a36491..845e3f55ea 100644 --- a/core/src/main/resources/hudson/slaves/Messages.properties +++ b/core/src/main/resources/hudson/slaves/Messages.properties @@ -1,6 +1,6 @@ # The MIT License # -# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe, Stephen Connolly +# Copyright (c) 2004-2011, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe, Stephen Connolly # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -37,3 +37,4 @@ SimpleScheduledRetentionStrategy.FinishedUpTime=Computer has finished its schedu SimpleScheduledRetentionStrategy.displayName=Take this slave on-line according to a schedule EnvironmentVariablesNodeProperty.displayName=Environment variables SlaveComputer.DisconnectedBy=Disconnected by {0}{1} +NodeDescripter.CheckName.Mandatory=Name is mandatory diff --git a/core/src/main/resources/hudson/slaves/Messages_ja.properties b/core/src/main/resources/hudson/slaves/Messages_ja.properties index dbd47c08eb..0cd0ed02c1 100644 --- a/core/src/main/resources/hudson/slaves/Messages_ja.properties +++ b/core/src/main/resources/hudson/slaves/Messages_ja.properties @@ -1,6 +1,6 @@ # The MIT License # -# Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe +# Copyright (c) 2004-2011, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -20,20 +20,21 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -RetentionStrategy.Always.displayName=\u53EF\u80FD\u306A\u9650\u308A\u30AA\u30F3\u30E9\u30A4\u30F3\u306E\u307E\u307E\u306B\u3059\u308B -RetentionStrategy.Demand.displayName=\u8981\u6C42\u6642\u306B\u306F\u30AA\u30F3\u30E9\u30A4\u30F3\u306B\u3057\u3001\u5F85\u6A5F\u4E2D\u306B\u306F\u30AA\u30D5\u30E9\u30A4\u30F3\u306B\u3059\u308B -RetentionStrategy.Demand.OfflineIdle=\u30B3\u30F3\u30D4\u30E5\u30FC\u30BF\u304C\u5F85\u6A5F\u4E2D\u306A\u306E\u3067\u30AA\u30D5\u30E9\u30A4\u30F3\u3067\u3059\u3002\u5FC5\u8981\u306B\u306A\u3063\u305F\u3089\u518D\u3073\u8D77\u52D5\u3057\u307E\u3059\u3002 -CommandLauncher.displayName=\u30DE\u30B9\u30BF\u30FC\u3067\u30B3\u30DE\u30F3\u30C9\u3092\u5B9F\u884C\u3057\u3066\u30B9\u30EC\u30FC\u30D6\u3092\u8D77\u52D5 -JNLPLauncher.displayName=JNLP\u7D4C\u7531\u3067\u30B9\u30EC\u30FC\u30D6\u3092\u8D77\u52D5 -ComputerLauncher.unexpectedError=\u30B9\u30EC\u30FC\u30D6\u306E\u8D77\u52D5\u4E2D\u306B\u4E88\u671F\u3057\u306A\u3044\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u3053\u308C\u306F\u305F\u3076\u3093Hudson\u306E\u30D0\u30B0\u3067\u3059\u3002 -ComputerLauncher.abortedLaunch=\u30B9\u30EC\u30FC\u30D6\u306E\u8D77\u52D5\u30D7\u30ED\u30BB\u30B9\u304C\u4E2D\u65AD\u3057\u307E\u3057\u305F\u3002 -CommandLauncher.NoLaunchCommand=\u8D77\u52D5\u30B3\u30DE\u30F3\u30C9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 -ConnectionActivityMonitor.OfflineCause=\u4F55\u5EA6\u3082ping\u304C\u5931\u6557\u3057\u307E\u3057\u305F\u3002 -DumbSlave.displayName=\u30C0\u30E0\u30B9\u30EC\u30FC\u30D6 +RetentionStrategy.Always.displayName=\u53ef\u80fd\u306a\u9650\u308a\u30aa\u30f3\u30e9\u30a4\u30f3\u306e\u307e\u307e\u306b\u3059\u308b +RetentionStrategy.Demand.displayName=\u8981\u6c42\u6642\u306b\u306f\u30aa\u30f3\u30e9\u30a4\u30f3\u306b\u3057\u3001\u5f85\u6a5f\u4e2d\u306b\u306f\u30aa\u30d5\u30e9\u30a4\u30f3\u306b\u3059\u308b +RetentionStrategy.Demand.OfflineIdle=\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u304c\u5f85\u6a5f\u4e2d\u306a\u306e\u3067\u30aa\u30d5\u30e9\u30a4\u30f3\u3067\u3059\u3002\u5fc5\u8981\u306b\u306a\u3063\u305f\u3089\u518d\u3073\u8d77\u52d5\u3057\u307e\u3059\u3002 +CommandLauncher.displayName=\u30de\u30b9\u30bf\u30fc\u3067\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u30b9\u30ec\u30fc\u30d6\u3092\u8d77\u52d5 +JNLPLauncher.displayName=JNLP\u7d4c\u7531\u3067\u30b9\u30ec\u30fc\u30d6\u3092\u8d77\u52d5 +ComputerLauncher.unexpectedError=\u30b9\u30ec\u30fc\u30d6\u306e\u8d77\u52d5\u4e2d\u306b\u4e88\u671f\u3057\u306a\u3044\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002\u3053\u308c\u306f\u305f\u3076\u3093Hudson\u306e\u30d0\u30b0\u3067\u3059\u3002 +ComputerLauncher.abortedLaunch=\u30b9\u30ec\u30fc\u30d6\u306e\u8d77\u52d5\u30d7\u30ed\u30bb\u30b9\u304c\u4e2d\u65ad\u3057\u307e\u3057\u305f\u3002 +CommandLauncher.NoLaunchCommand=\u8d77\u52d5\u30b3\u30de\u30f3\u30c9\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 +ConnectionActivityMonitor.OfflineCause=\u4f55\u5ea6\u3082ping\u304c\u5931\u6557\u3057\u307e\u3057\u305f\u3002 +DumbSlave.displayName=\u30c0\u30e0\u30b9\u30ec\u30fc\u30d6 NodeProvisioner.EmptyString= -OfflineCause.DisconnectedFromCLI=CLI\u3068\u306E\u63A5\u7D9A\u304C\u5207\u65AD\u3055\u308C\u307E\u3057\u305F\u3002 -OfflineCause.LaunchFailed=\u30B9\u30EC\u30FC\u30D6\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u306E\u8D77\u52D5\u306B\u5931\u6557\u3057\u305F\u305F\u3081\u3001\u3053\u306E\u30CE\u30FC\u30C9\u306F\u30AA\u30D5\u30E9\u30A4\u30F3\u3067\u3059\u3002 -SimpleScheduledRetentionStrategy.FinishedUpTime=\u30B3\u30F3\u30D4\u30E5\u30FC\u30BF\u306E\u52D5\u4F5C\u53EF\u80FD\u6642\u9593\u304C\u7D42\u4E86\u3057\u307E\u3057\u305F\u3002 -SimpleScheduledRetentionStrategy.displayName=\u30B9\u30B1\u30B8\u30E5\u30FC\u30EB\u306B\u5F93\u3063\u3066\u30AA\u30F3\u30E9\u30A4\u30F3\u306B\u3059\u308B -EnvironmentVariablesNodeProperty.displayName=\u74B0\u5883\u5909\u6570 -SlaveComputer.DisconnectedBy={0}\u304C\u30AA\u30D5\u30E9\u30A4\u30F3\u306B\u3057\u3066\u3044\u307E\u3059\u3002{1} +OfflineCause.DisconnectedFromCLI=CLI\u3068\u306e\u63a5\u7d9a\u304c\u5207\u65ad\u3055\u308c\u307e\u3057\u305f\u3002 +OfflineCause.LaunchFailed=\u30b9\u30ec\u30fc\u30d6\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306e\u8d77\u52d5\u306b\u5931\u6557\u3057\u305f\u305f\u3081\u3001\u3053\u306e\u30ce\u30fc\u30c9\u306f\u30aa\u30d5\u30e9\u30a4\u30f3\u3067\u3059\u3002 +SimpleScheduledRetentionStrategy.FinishedUpTime=\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306e\u52d5\u4f5c\u53ef\u80fd\u6642\u9593\u304c\u7d42\u4e86\u3057\u307e\u3057\u305f\u3002 +SimpleScheduledRetentionStrategy.displayName=\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u306b\u5f93\u3063\u3066\u30aa\u30f3\u30e9\u30a4\u30f3\u306b\u3059\u308b +EnvironmentVariablesNodeProperty.displayName=\u74b0\u5883\u5909\u6570 +SlaveComputer.DisconnectedBy={0}\u304c\u30aa\u30d5\u30e9\u30a4\u30f3\u306b\u3057\u3066\u3044\u307e\u3059\u3002{1} +NodeDescripter.CheckName.Mandatory=\u30ce\u30fc\u30c9\u540d\u306f\u5fc5\u9808\u3067\u3059\u3002