@Override public boolean visit(final SshKeyToRouterRules sshkey) throws ResourceUnavailableException { final VirtualRouter router = sshkey.getRouter(); final VirtualMachineProfile profile = sshkey.getProfile(); final String sshKeystr = sshkey.getSshPublicKey(); final UserVmVO userVM = sshkey.getUserVM(); final Commands commands = new Commands(Command.OnError.Stop); final NicVO nicVo = sshkey.getNicVo(); final VMTemplateVO template = sshkey.getTemplate(); if (template != null && template.isEnablePassword()) { _commandSetupHelper.createPasswordCommand(router, profile, nicVo, commands); } _commandSetupHelper.createVmDataCommand(router, userVM, nicVo, sshKeystr, commands); return _networkGeneralHelper.sendCommandsToRouter(router, commands); }
@Override public boolean saveSSHPublicKeyToRouter(final Network network, final NicProfile nic, final VirtualMachineProfile profile, final VirtualRouter router, final String sshPublicKey) throws ResourceUnavailableException { s_logger.debug("SAVE SSH PUB KEY TO ROUTE RULES"); final String typeString = "save SSHkey entry"; final boolean isPodLevelException = false; final boolean failWhenDisconnect = false; final Long podId = null; final SshKeyToRouterRules keyToRouterRules = new SshKeyToRouterRules(network, nic, profile, sshPublicKey); return applyRules(network, router, typeString, isPodLevelException, podId, failWhenDisconnect, new RuleApplierWrapper<RuleApplier>(keyToRouterRules)); }