static boolean isSSHNode(Node node) { if (node == null) return false; return node.getType().equals("SSH"); }
static boolean isSSHNode(Node node) { if (node == null) return false; return node.getType().equals("SSH"); }
private boolean userManagedNodeType() { if(theNode.isLocal()) return false; if(theNode.getType().equals("SSH")) return false; return true; } }
private int runAdminCommandOnRemoteNode(Node node, StringBuilder output, List<String> args, List<String> stdinLines) throws SSHCommandExecutionException, IllegalArgumentException, UnsupportedOperationException { // don't want to call a config object proxy more than absolutely necessary! String type = node.getType(); if ("SSH".equals(type)) { NodeRunnerSsh nrs = new NodeRunnerSsh(habitat, logger); int result = nrs.runAdminCommandOnRemoteNode(node, output, args, stdinLines); lastCommandRun = nrs.getLastCommandRun(); return result; } throw new UnsupportedOperationException("Node is not of type SSH"); }
String nodeType = n.getType(); String host = n.getNodeHost(); String installDir = n.getInstallDir();
String nodeType = n.getType(); String host = n.getNodeHost(); String installDir = n.getInstallDir();
if (theNode.isLocal() || (!theNode.isLocal() && theNode.getType().equals("SSH"))) { ActionReport report = ctx.getActionReport(); report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
if (theNode.isLocal() || (!theNode.isLocal() && theNode.getType().equals("SSH"))) { ActionReport report = ctx.getActionReport(); report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
type = RemoteType.valueOf(node.getType());
/** * Make sure we can make an SSH connection using an existing node. * * @param node Node to connect to * @throws CommandValidationException */ void pingRemoteConnection(Node node) throws CommandValidationException { RemoteType type = RemoteType.valueOf(node.getType()); validateHostName(node.getNodeHost()); switch (type) { case SSH: pingSSHConnection(node); break; default: throw new CommandValidationException("Internal Error: unknown type"); } }
if (!theNode.isLocal() && !theNode.getType().equals("SSH")){ String msg = Strings.get("create.instance.config", instance, humanCommand);
@Override public void execute(AdminCommandContext context) { ActionReport report = context.getActionReport(); Logger logger = context.logger; Node node = nodes.getNode(name); if (node == null) { //no node to delete nothing to do here String msg = Strings.get("noSuchNode", name); logger.warning(msg); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage(msg); return; } if (!(node.getType().equals("CONFIG") )){ //no node to delete nothing to do here String msg = Strings.get("notConfigNodeType", name); logger.warning(msg); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage(msg); return; } CommandInvocation ci = cr.getCommandInvocation("_delete-node", report); ParameterMap map = new ParameterMap(); map.add("DEFAULT", name); ci.parameters(map); ci.execute(); }
@Override public void execute(AdminCommandContext context) { ActionReport report = context.getActionReport(); Logger logger = context.getLogger(); Node node = nodes.getNode(name); if (node == null) { //no node to delete nothing to do here String msg = Strings.get("noSuchNode", name); logger.warning(msg); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage(msg); return; } if (!(node.getType().equals("CONFIG") )){ //no node to delete nothing to do here String msg = Strings.get("notConfigNodeType", name); logger.warning(msg); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage(msg); return; } CommandInvocation ci = cr.getCommandInvocation("_delete-node", report, context.getSubject()); ParameterMap map = new ParameterMap(); map.add("DEFAULT", name); ci.parameters(map); ci.execute(); }
} else if (node.getType().equals("SSH")) {
return; String type = node.getType(); if ((type == null) || (type.equals("CONFIG"))) {
void validate(Node node) throws CommandValidationException { // Put node values into parameter map and validate ParameterMap map = new ParameterMap(); map.add("DEFAULT", node.getName()); map.add(NodeUtils.PARAM_INSTALLDIR, node.getInstallDir()); map.add(NodeUtils.PARAM_NODEHOST, node.getNodeHost()); map.add(NodeUtils.PARAM_NODEDIR, node.getNodeDirAbsolute()); SshConnector sshc = node.getSshConnector(); if (sshc != null) { map.add(NodeUtils.PARAM_REMOTEPORT, sshc.getSshPort()); SshAuth ssha = sshc.getSshAuth(); map.add(NodeUtils.PARAM_REMOTEUSER, ssha.getUserName()); map.add(NodeUtils.PARAM_SSHKEYFILE, ssha.getKeyfile()); map.add(NodeUtils.PARAM_REMOTEPASSWORD, ssha.getPassword()); map.add(NodeUtils.PARAM_SSHKEYPASSPHRASE, ssha.getKeyPassphrase()); map.add(NodeUtils.PARAM_TYPE, node.getType()); } validate(map); return; }