Hello, 

We are using Jenkins with multiple slaves (17 and soon more ), all are VBox 
Ubuntu guests. 
I want to execute an administrative shell script on all slaves using the 
script console in Jenkins manage. 
for example gathering mac addresses running ifconfig. 

I've tried to google the subject several times in the past couple of weeks, 
unfortunately with no answers. 
This is what I came up with so far : 

//def logger = ???? 
  
for (slave in hudson.model.Hudson.instance.slaves) { 
    println('Proceswsing Slave ' + slave.name); 
  
        def launcher = slave.createLauncher(); 
        
        def command = new hudson.util.ArgumentListBuilder(); 
        command.addTokenized("ifconfig | grep HWaddr"); 
    
        def ps = new hudson.Launcher.ProcStarter(); 
        ps = ps.cmds(command); 
        //ps = ps.stdout(logger);   
        
        def proc = launcher.launch(ps); 
  def retcode = proc.join(); 
  println("ret code="+retcode) 
  
} 

but running this fails with the following exception : 

java.lang.NullPointerException 
        at hudson.Launcher.printCommandLine(Launcher.java:615) 
        at hudson.Launcher.maskedPrintCommandLine(Launcher.java:642) 
        at hudson.Launcher$LocalLauncher.launch(Launcher.java:764) 
        at hudson.Launcher$ProcStarter.start(Launcher.java:353) 
        at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:998) 
        at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:965) 
        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 
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:166) 
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) 
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
        at java.lang.Thread.run(Thread.java:679) 


As I understand the ProcStarter needs to be specified with a TaskListener. 
How do I get the TaskListener that will take the output of the executed 
commands and print it below the script console? 

Also if you have a better way to achieve my goal I will be happy to hear. 

Thanks, 
Omer 

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to