Package com.dtolabs.rundeck.core.execution

Examples of com.dtolabs.rundeck.core.execution.ExecutionException


                                       final String[] args) throws ExecutionException {
        final String commandexecutable;
        final String[] commandargs;

        if (!command && null == scriptfile) {
            throw new ExecutionException("Could not determine the command to dispatch");
        }
        if ("windows".equals(nodeentry.getOsFamily())) {
            //TODO: escape args properly for windows
            commandexecutable = "cmd.exe";
            if (command) {
                ArrayList<String> list = new ArrayList<String>();
                list.add(0, "/c");
                list.addAll(Arrays.asList(args));
                commandargs = list.toArray(new String[list.size()]);
            } else if (null != scriptfile) {
                //commandString is the script file location
                ArrayList<String> list = new ArrayList<String>();
                list.add(scriptfile.getAbsolutePath());
                if(args!=null && args.length>0){
                    list.addAll(Arrays.asList(args));
                }
                list.add(0,"/c");
                commandargs = list.toArray(new String[list.size()]);
            } else {
                throw new ExecutionException("Could not determine the command to dispatch");
            }
        } else {
            if (command) {
                commandexecutable = "/bin/sh";
                commandargs = new String[]{"-c", StringUtils.join(args, " ")};
            } else if (null != scriptfile) {
                final String scriptPath = scriptfile.getAbsolutePath();
                commandexecutable = scriptPath;
                commandargs=args;
            } else {
                throw new ExecutionException("Could not determine the command to dispatch");
            }
        }
        return new ExecTaskParameters() {
            public String getCommandexecutable() {
                return commandexecutable;
View Full Code Here

TOP

Related Classes of com.dtolabs.rundeck.core.execution.ExecutionException

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.