Package com.sun.grid.installer.util.cmd

Examples of com.sun.grid.installer.util.cmd.CopyExecutableCommand


            checkHostFile = Util.fillUpTemplate(checkHostTempFile, checkHostFile, variables);
            remoteFile = checkHostFile.substring(0, checkHostFile.length() - 4);
            new File(checkHostFile).deleteOnExit();          

            Debug.trace("Copy auto_conf file to '" + host.getHostname() + ":" + checkHostFile + "'.");
            CopyExecutableCommand copyCmd = new CopyExecutableCommand(host.getResolveTimeout(), host.getHostname(), host.getConnectUser(),
                    variables.getProperty(VAR_SHELL_NAME, ""), (Util.IS_MODE_WINDOWS && host.getArchitecture().startsWith("win")), checkHostFile, remoteFile);
            copyCmd.execute();
            exitValue = copyCmd.getExitValue();
            if (exitValue == EXIT_VAL_CMDEXEC_TERMINATED) {
                //Set the log content
                newState = Host.State.COPY_TIMEOUT_CHECK_HOST;
                Debug.error("Timeout while copying the " + checkHostFile + " script to host " + host.getHostname() + " via " + variables.getProperty(VAR_COPY_COMMAND) + " command!\nMaybe a password is expected. Try the command in the terminal first.");
            } else if (exitValue == EXIT_VAL_CMDEXEC_INTERRUPTED) {
View Full Code Here


        Host.State state = Host.State.UNKNOWN_ERROR;
        handler.setHostState(host, Host.State.PROCESSING);

        RemoteComponentScriptCommand installCmd = null;
        CopyExecutableCommand copyCmd = null;
       
        boolean isSpecialTask = Boolean.valueOf(variables.getProperty(VAR_FIRST_TASK, "false")) || Boolean.valueOf(variables.getProperty(VAR_LAST_TASK, "false"));
        VariableSubstitutor vs  = new VariableSubstitutor(variables);
        String log = "";

        try {
            String autoConfFile = null;
            String remoteFile = "";
            int exitValue;

            if (host.isBdbHost() || host.isQmasterHost() || host.isShadowHost() || host.isExecutionHost() || isSpecialTask) {
                if (!isSpecialTask) {
                    if (host.isQmasterHost()) {
                        // shadow host installation  is done in separate task
                        variables.put(VAR_SHADOW_HOST_LIST, "");
                    }

                    // Fill up cfg.exec.spool.dir.local
                    if (host.isExecutionHost() && !host.getSpoolDir().equals(variables.getProperty(VAR_EXECD_SPOOL_DIR))) {
                        variables.setProperty(VAR_EXECD_SPOOL_DIR_LOCAL, host.getSpoolDir());
                    } else {
                        variables.setProperty(VAR_EXECD_SPOOL_DIR_LOCAL, "");
                    }
                }

                String autoConfTempFile = vs.substituteMultiple(variables.getProperty(VAR_AUTO_INSTALL_COMPONENT_TEMP_FILE), null);
                autoConfFile = vs.substituteMultiple(variables.getProperty(VAR_AUTO_INSTALL_COMPONENT_FILE), null);

                //Appended CELL_NAME prevents a race in case of parallel multiple cell installations
                String taskName = isSpecialTask == true ? (Boolean.valueOf(variables.getProperty(VAR_FIRST_TASK, "false")).booleanValue() == true ? "first_task" : "last_task") : host.getComponentString();
                autoConfFile = "/tmp/" + autoConfFile + "." + host.getHostname() + "." + taskName + "." + variables.getProperty(VAR_SGE_CELL_NAME) + ".tmp";               
                Debug.trace("Generating auto_conf file: '" + autoConfFile + "'.");
                autoConfFile = Util.fillUpTemplate(autoConfTempFile, autoConfFile, variables);
                remoteFile = autoConfFile.substring(0, autoConfFile.length() - 4);
                new File(autoConfFile).deleteOnExit();
            }

            if (!isIsTestMode()) {
                /**
                 * Copy install_component script
                 */
                Debug.trace("Copy auto_conf file to '" + host.getHostname() + ":" + autoConfFile + "'.");
                copyCmd = new CopyExecutableCommand(host.getResolveTimeout(), host.getHostname(), host.getConnectUser(),
                        variables.getProperty(VAR_SHELL_NAME, ""), (Util.IS_MODE_WINDOWS && host.getArchitecture().startsWith("win")), autoConfFile, remoteFile);
                copyCmd.execute();
                exitValue = copyCmd.getExitValue();
            } else {
                log = Util.listToString(getTestOutput());
                exitValue = getTestExitValue();
            }

            if (exitValue == EXIT_VAL_CMDEXEC_TERMINATED) {
                state = Host.State.COPY_TIMEOUT_INSTALL_COMPONENT;
                if (copyCmd != null) {
                    copyCmd.setFirstLogMessage("Timeout while copying the " + autoConfFile + " script to host " + host.getHostname() + " via " + variables.getProperty(VAR_COPY_COMMAND) + " command!\nMaybe a password is expected. Try the command in the terminal first.");
                    log = copyCmd.generateLog(msgs);
                }
            } else if (exitValue == EXIT_VAL_CMDEXEC_INTERRUPTED) {
                state = Host.State.CANCELED;
                if (copyCmd != null) {
                    copyCmd.setFirstLogMessage("Cancelled copy action!");
                    log = copyCmd.generateLog(msgs);
                }
            } else if (exitValue != 0) {
                state = Host.State.COPY_FAILED_INSTALL_COMPONENT;
                if (copyCmd != null) {
                    copyCmd.setFirstLogMessage("Error when copying the file " + autoConfFile + "to host " + host.getHostname() + " via " + variables.getProperty(VAR_COPY_COMMAND) + " command!\n");
                    log = copyCmd.generateLog(msgs);
                }
            } else {
                /**
                 * Execute installation
                 */
 
View Full Code Here

TOP

Related Classes of com.sun.grid.installer.util.cmd.CopyExecutableCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.