Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-31321

Renaming a node over another is possible and destroys both configurations

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • core
    • Software version: Jenkins ver. 1.635
      Possibly related plug-in: Windows Slaves Plugin
      Java version: 1.8.0_66
      Operating system: Windows Server 2008 R2

      When performing a node name rework, it is possible (partially?) overwrite a node with another one simply by renaming an existing node.

      Steps to reproduce:

      1. Create a node named foo
      2. Create another node named bar
      3. Go to the bar node configuration
      4. Rename it to foo and press Save

      Expected results:

      • An error message.

      Actual results:

      • Node bar replaces foo without any notice
      • Things start to behave wacky: build starts to fail without a reason (see attached edited log, Jenkins-BuildBreakageAfterNodeRename.txt

          [JENKINS-31321] Renaming a node over another is possible and destroys both configurations

          Helder Magalhães created issue -
          Daniel Beck made changes -
          Priority Original: Major [ 3 ] New: Critical [ 2 ]
          Christopher Simons made changes -
          Assignee New: Christopher Simons [ csimons ]
          Christopher Simons made changes -
          Description Original: When performing a node name rework, I was able to overwrite a node with another one simply by renaming (which is a bit strange) but, apparently, the configuration of the "new" node was broken so it was necessary to delete it and create it from scratch.

          Steps to reproduce:
          # Create a node named {{foo}}
          # Make {{foo}} node as temporarily offline
          # Create another node named {{bar}}
          # Go to the {{bar}} node configuration
          # Rename it to {{foo}} and press _Save_

          Expected results:
          * A prompt asking if that's what the user really intends:
          ** _Yes_ would be the equivalent to deleting {{foo}} node and replacing its configuration contents with the one from {{bar}} (now named {{foo}})
          ** _No_ would cause the operation to be aborted

          Actual results:
          * Node {{bar}} replaces {{foo}} without any notice
          * Things start to behave wacky: build starts to fail without a reason (see attached edited log, {{Jenkins-BuildBreakageAfterNodeRename.txt}}

          Disclaimer: I wasn't able to validate the exact steps to reproduce procedure *nor* if making the node temporarily offline is really necessary as a Jenkins test instance was not available (procedure was compiled from memory).

          Workaround:
          * Delete a node before renaming another one over it
          * If such an undesired node rename was made, delete and reconfigure the affected node again

          Priority set to "major" as loss of information (node configuration) is involved. Build breakage (until the problem is understood and fixed) is also triggered, although that's not as serious and could be considered "minor".
          New: When performing a node name rework, it is possible (partially?) overwrite a node with another one simply by renaming an existing node.

          Steps to reproduce:
          # Create a node named {{foo}}
          # Create another node named {{bar}}
          # Go to the {{bar}} node configuration
          # Rename it to {{foo}} and press _Save_

          Expected results:
          * An error message.

          Actual results:
          * Node {{bar}} replaces {{foo}} without any notice
          * Things start to behave wacky: build starts to fail without a reason (see attached edited log, {{Jenkins-BuildBreakageAfterNodeRename.txt}}

          Christopher Simons added a comment - - edited

          When attempting to create a new node with the same name as an existing node (rather than editing), an error page is rendered with the message "Error: Slave called ‘foo’ already exists" and HTTP status 400. I'd propose throwing this same error upon trying to rename a node over another existing node.

          Fixed in PR #1949.

          Christopher Simons added a comment - - edited When attempting to create a new node with the same name as an existing node (rather than editing), an error page is rendered with the message "Error: Slave called ‘foo’ already exists" and HTTP status 400. I'd propose throwing this same error upon trying to rename a node over another existing node. Fixed in PR #1949 .
          Christopher Simons made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          Code changed in jenkins
          User: Christopher Simons
          Path:
          core/src/main/java/hudson/model/Computer.java
          test/src/test/java/hudson/model/ComputerTest.java
          http://jenkins-ci.org/commit/jenkins/16d6429c58400b18350c42280ac541a6322ac8f3
          Log:
          [FIXED JENKINS-31321] protect against node-rename corruption

          This change adds code to check that the user isn't attempting to rename
          an existing node with the name of another existing node. Previous to
          this change, such rename operations would succeed and would corrupt node
          configuration data.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Christopher Simons Path: core/src/main/java/hudson/model/Computer.java test/src/test/java/hudson/model/ComputerTest.java http://jenkins-ci.org/commit/jenkins/16d6429c58400b18350c42280ac541a6322ac8f3 Log: [FIXED JENKINS-31321] protect against node-rename corruption This change adds code to check that the user isn't attempting to rename an existing node with the name of another existing node. Previous to this change, such rename operations would succeed and would corrupt node configuration data.
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]

          Code changed in jenkins
          User: Daniel Beck
          Path:
          core/src/main/java/hudson/model/Computer.java
          test/src/test/java/hudson/model/ComputerTest.java
          http://jenkins-ci.org/commit/jenkins/ad5b2d12a6674a827d1ce3b8cf8c7493626ab586
          Log:
          Merge pull request #1949 from csimons/prohibit-rename-node-to-existing

          [FIXED JENKINS-31321] protect against node-rename corruption

          Compare: https://github.com/jenkinsci/jenkins/compare/068c09f21afa...ad5b2d12a667

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: core/src/main/java/hudson/model/Computer.java test/src/test/java/hudson/model/ComputerTest.java http://jenkins-ci.org/commit/jenkins/ad5b2d12a6674a827d1ce3b8cf8c7493626ab586 Log: Merge pull request #1949 from csimons/prohibit-rename-node-to-existing [FIXED JENKINS-31321] protect against node-rename corruption Compare: https://github.com/jenkinsci/jenkins/compare/068c09f21afa...ad5b2d12a667

          dogfood added a comment -

          Integrated in jenkins_main_trunk #4408
          [FIXED JENKINS-31321] protect against node-rename corruption (Revision 16d6429c58400b18350c42280ac541a6322ac8f3)

          Result = UNSTABLE
          christopherleesimons : 16d6429c58400b18350c42280ac541a6322ac8f3
          Files :

          • test/src/test/java/hudson/model/ComputerTest.java
          • core/src/main/java/hudson/model/Computer.java

          dogfood added a comment - Integrated in jenkins_main_trunk #4408 [FIXED JENKINS-31321] protect against node-rename corruption (Revision 16d6429c58400b18350c42280ac541a6322ac8f3) Result = UNSTABLE christopherleesimons : 16d6429c58400b18350c42280ac541a6322ac8f3 Files : test/src/test/java/hudson/model/ComputerTest.java core/src/main/java/hudson/model/Computer.java

            csimons Christopher Simons
            heldermagalhaes Helder Magalhães
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: