0

我正在尝试从管道脚本中的 xml 文件中读取服务器名称。

我的代码:

node {

   def str = "<root><HTTPTargetConnection><Loadbalancer><server name=\"myserver\" /> </Loadbalancer></HTTPTargetConnection></root>";

   def rootNode = new XmlParser().parseText(str);

   echo rootNode.HTTPTargetConnection.Loadbalancer.server.@name.value[0];

}

例外: [管道] 管道结束 *

org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException:在 org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.unclassifiedField(SandboxInterceptor.java:367) 在 org.jenkinsci.plugins 的未分类字段 groovy.util.Node HTTPTargetConnection。 scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:363) at org.kohsuke.groovy.sandbox.impl.Checker$4.call(Checker.java:241)

请帮我解决这个问题。

4

1 回答 1

0

您遇到了沙盒问题。相关字段未被授权使用,因此必须获得批准(在脚本批准页面中)。

于 2018-11-08T21:40:13.547 回答