Skip to content

Instantly share code, notes, and snippets.

@xeon22
Created February 6, 2014 17:01
Show Gist options
  • Save xeon22/8848292 to your computer and use it in GitHub Desktop.
Save xeon22/8848292 to your computer and use it in GitHub Desktop.
Chef run error jenkins ssh slave
STDERR: groovy.lang.MissingPropertyException: No such property: jenkins for class: RemoteClass
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
at RemoteClass.run(RemoteClass:39)
at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:266)
at groovy.lang.GroovyShell.run(GroovyShell.java:517)
at hudson.cli.GroovyCommand.run(GroovyCommand.java:94)
at hudson.cli.CLICommand.main(CLICommand.java:232)
at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:92)
at sun.reflect.GeneratedMethodAccessor24588.invoke(Unknown Source)
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:299)
at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:280)
at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:239)
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:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
---- End output of java -jar /var/chef/cache/jenkins-cli.jar -s http://hq-tor-build-01.quickplay.local/jenkins -i /var/chef/cache/jenkins-key groovy = <<-GROOVY_SCRIPT
import hudson.model.*
import hudson.slaves.*
import jenkins.model.*
import jenkins.slaves.*
slave = Jenkins.instance.getNode('computername') as Slave
if(slave == null) {
return null
}
current_slave = [
name:slave.name,
description:slave.nodeDescription,
remote_fs:slave.remoteFS,
executors:slave.numExecutors.toInteger(),
usage_mode:slave.mode.toString().toLowerCase(),
labels:slave.labelString.split().sort(),
environment:slave.nodeProperties.get(EnvironmentVariablesNodeProperty.class)?.envVars,
connected:(slave.computer.connectTime > 0),
online:slave.computer.online
]
// Determine retention strategy
if (slave.retentionStrategy instanceof RetentionStrategy.Always) {
current_slave['availability'] = 'always'
} else if (slave.retentionStrategy instanceof RetentionStrategy.Demand) {
current_slave['availability'] = 'demand'
retention = slave.retentionStrategy as RetentionStrategy.Demand
current_slave['in_demand_delay'] = retention.inDemandDelay
current_slave['idle_delay'] = retention.idleDelay
} else {
current_slave['availability'] = null
}
current_slave['host'] = slave.launcher.host
current_slave['port'] = slave.launcher.port
current_slave['jvm_options'] = slave.launcher.jvmOptions
current_slave['command_prefix'] = jenkins.launcher.prefixStartSlaveCmd
current_slave['command_suffix'] = jenkins.launcher.suffixStartSlaveCmd
current_slave['credentials'] = hudson.plugins.sshslaves.SSHLauncher.lookupSystemCredentials(slave.launcher.credentialsId).username
builder = new groovy.json.JsonBuilder(current_slave)
println(builder)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment