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

changing metadata containing External Resource TreeNode by jenkins-cli/json doesn't work

XMLWordPrintable

      Occurs in jenkins v 1.510 (and the older one too) with external-resource-dispatcher v1.0b

      Steps to reproduce:
      1. Start with fresh jenkins with resources plugin
      2. Create node "NodeT": launch method = launch slave agents via web start
      3. Add metadata to node
      4. add External Resource TreeNode "TreeNodeName" to the node metadata
      5. add Resource to TreeNode: "ResourceName", id=7417, enabled
      6. save node
      7. start node via webstart
      8. download node metadata (output attached):
      $ jenkins-cli -s http://localhost:8080 get-metadata -node NodeT > metadata.json
      9. (optionally modify something in metadata.json)
      10. try to upload metadata:
      $ jenkins-cli -s http://localhost:8080 update-metadata -replace -node NodeT < metadata.json

      Expected result:
      Metadata should be updated (replaced)

      Actual result
      Exception is thrown:
      $ jenkins-cli -s http://localhost:8080 update-metadata -replace -node NodeT < metadata.json
      Failed to authenticate with your SSH keys. Proceeding with anonymous access
      java.lang.IllegalArgumentException: The child value is null
      at com.sonyericsson.hudson.plugins.metadata.model.values.ParentUtil.replaceChild(ParentUtil.java:63)
      at com.sonyericsson.hudson.plugins.metadata.model.values.ParentUtil.replaceChildren(ParentUtil.java:100)
      at com.sonyericsson.hudson.plugins.metadata.cli.UpdateMetadataCommand.run(UpdateMetadataCommand.java:129)
      at hudson.cli.CLICommand.main(CLICommand.java:229)
      at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:92)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:275)
      at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:256)
      at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:215)
      at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      at hudson.remoting.Request$2.run(Request.java:326)
      at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      at hudson.cli.CliManagerImpl$1.call(CliManagerImpl.java:63)
      at hudson.remoting.InterceptingExecutorService$2.call(InterceptingExecutorService.java:95)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
      at java.lang.Thread.run(Thread.java:662)

      Cause of error and FIX:
      ExternalResourceTreeNode.ExternalResourceTreeNodeDescriptor.fromJson(..) is not implemented (always returns null).
      Attached patch adds implementation. it's based on similar function for ExternalResource.

            rsandell rsandell
            mateuszalewicki Mateusz Lewicki
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: