Search in sources :

Example 1 with ForkOutputStream

use of hudson.util.ForkOutputStream in project hudson-2.x by hudson.

the class ZFSInstaller method init.

@Extension
public static AdministrativeMonitor init() {
    String migrationTarget = System.getProperty(ZFSInstaller.class.getName() + ".migrate");
    if (migrationTarget != null) {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        StreamTaskListener listener = new StreamTaskListener(new ForkOutputStream(System.out, out));
        try {
            if (migrate(listener, migrationTarget)) {
                // completed successfully
                return new MigrationCompleteNotice();
            }
        } catch (Exception e) {
            // if we let any exception from here, it will prevent Hudson from starting.
            e.printStackTrace(listener.error("Migration failed"));
        }
        // migration failed
        return new MigrationFailedNotice(out);
    }
    // install the monitor if applicable
    ZFSInstaller zi = new ZFSInstaller();
    if (zi.isActivated())
        return zi;
    return null;
}
Also used : ForkOutputStream(hudson.util.ForkOutputStream) StreamTaskListener(hudson.util.StreamTaskListener) ByteArrayOutputStream(org.apache.commons.io.output.ByteArrayOutputStream) ServletException(javax.servlet.ServletException) ZFSException(org.jvnet.solaris.libzfs.ZFSException) IOException(java.io.IOException) Extension(hudson.Extension)

Aggregations

Extension (hudson.Extension)1 ForkOutputStream (hudson.util.ForkOutputStream)1 StreamTaskListener (hudson.util.StreamTaskListener)1 IOException (java.io.IOException)1 ServletException (javax.servlet.ServletException)1 ByteArrayOutputStream (org.apache.commons.io.output.ByteArrayOutputStream)1 ZFSException (org.jvnet.solaris.libzfs.ZFSException)1