Skip to content

Commit

Permalink
JENKINS-8676 Windows XP slave stopped working in 1.396 (related to na…
Browse files Browse the repository at this point in the history
…me change)

The ManagedWindowsServiceLauncher refers to hudson.exe and hudson-slave.exe while we renamed the artifact to jenkins.exe.

Tentative fix, completely untested (no windows box around).
Not sure about the service name (jenkinsslave). I added a second check for backward compatibility but I have no idea if it's useful.
  • Loading branch information
lacostej committed Feb 3, 2011
1 parent 2d45108 commit 2332b11
Showing 1 changed file with 8 additions and 5 deletions.
Expand Up @@ -212,14 +212,14 @@ public void launch(final SlaveComputer computer, final TaskListener listener) th

// copy exe
logger.println(Messages.ManagedWindowsServiceLauncher_CopyingSlaveExe());
copyStreamAndClose(getClass().getResource("/windows-service/hudson.exe").openStream(), new SmbFile(remoteRoot,"hudson-slave.exe").getOutputStream());
copyStreamAndClose(getClass().getResource("/windows-service/jenkins.exe").openStream(), new SmbFile(remoteRoot,"jenkins-slave.exe").getOutputStream());

copySlaveJar(logger, remoteRoot);

// copy hudson-slave.xml
// copy jenkins-slave.xml
logger.println(Messages.ManagedWindowsServiceLauncher_CopyingSlaveXml());
String xml = WindowsSlaveInstaller.generateSlaveXml(id,"javaw.exe","-tcp %BASE%\\port.txt");
copyStreamAndClose(new ByteArrayInputStream(xml.getBytes("UTF-8")), new SmbFile(remoteRoot,"hudson-slave.xml").getOutputStream());
copyStreamAndClose(new ByteArrayInputStream(xml.getBytes("UTF-8")), new SmbFile(remoteRoot,"jenkins-slave.xml").getOutputStream());

// install it as a service
logger.println(Messages.ManagedWindowsServiceLauncher_RegisteringService());
Expand All @@ -228,7 +228,7 @@ public void launch(final SlaveComputer computer, final TaskListener listener) th
int r = svc.Create(
id,
dom.selectSingleNode("/service/name").getText()+" at "+path,
path+"\\hudson-slave.exe",
path+"\\jenkins-slave.exe",
Win32OwnProcess, 0, "Manual", true);
if(r!=0) {
listener.error("Failed to create a service: "+svc.getErrorMessage(r));
Expand Down Expand Up @@ -310,7 +310,10 @@ public void afterDisconnect(SlaveComputer computer, TaskListener listener) {
JISession session = JISession.createSession(auth);
session.setGlobalSocketTimeout(60000);
SWbemServices services = WMI.connect(session, computer.getName());
Win32Service slaveService = services.getService("hudsonslave");
Win32Service slaveService = services.getService("jenkinsslave");
if(slaveService==null) { // backward compatibility. is this needed ?
slaveService = services.getService("hudsonslave");
}
if(slaveService!=null) {
listener.getLogger().println(Messages.ManagedWindowsServiceLauncher_StoppingService());
slaveService.StopService();
Expand Down

0 comments on commit 2332b11

Please sign in to comment.