Skip to content
Permalink
Browse files

Merge pull request #110 from jglick/CLI-JENKINS-41745

[JENKINS-41745] Allow SupportCommand to work without a Remoting channel
  • Loading branch information
christ66 committed Apr 6, 2017
2 parents 17ac515 + 18e6402 commit 9b3442585e6394e0b0f119817d6752a8cf913641
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/main/java/com/cloudbees/jenkins/support/SupportCommand.java
@@ -25,6 +25,7 @@
package com.cloudbees.jenkins.support;

import com.cloudbees.jenkins.support.api.Component;
import hudson.CloseProofOutputStream;
import hudson.Extension;
import hudson.cli.CLICommand;
import hudson.remoting.RemoteOutputStream;
@@ -81,7 +82,13 @@ protected int run() throws Exception {
try {
SecurityContext old = ACL.impersonate(ACL.SYSTEM);
try {
SupportPlugin.writeBundle(checkChannel().call(new SaveBundle(SupportPlugin.getBundleFileName())), selected);
OutputStream os;
if (channel != null) { // Remoting mode
os = channel.call(new SaveBundle(SupportPlugin.getBundleFileName()));
} else { // redirect output to a ZIP file yourself
os = new CloseProofOutputStream(stdout);
}
SupportPlugin.writeBundle(os, selected);
} finally {
SecurityContextHolder.setContext(old);
}

0 comments on commit 9b34425

Please sign in to comment.