public static Method getApproveSignature(Action action) throws NoSuchMethodException, SecurityException { if (action == null) { throw new ValidationException("Action is mandatory but was not provided."); } /** * using_root_password */ if (action!=null && action.getHost()!=null && action.getHost().getRootPassword()!=null ) { return HostResource.class.getMethod("approveUsingRootPassword", Action.class); } /** * using_ssh */ if (action!=null && action.getHost()!=null && action.getHost().getSsh()!=null && action.getHost().getSsh().getUser()!=null && action.getHost().getSsh().getUser().getUserName()!=null && action.getHost()!=null && action.getHost().getSsh()!=null && action.getHost().getSsh().getUser()!=null && action.getHost().getSsh().getUser().getPassword()!=null && action.getHost()!=null && action.getHost().getSsh()!=null && action.getHost().getSsh().getAuthenticationMethod()!=null ) { return HostResource.class.getMethod("approveUsingSsh", Action.class); } throw new ValidationException("No matching signature found, make sure that mandatory attributes are provided."); }
if (StringUtils.equals(userName, "root")) { entity.setUserName(userName); String userPassword = user.getPassword(); if (userPassword != null) { entity.setRootPassword(userPassword);
@Override public Response approve(Action action) { if (action.isSetCluster() && (action.getCluster().isSetId() || action.getCluster().isSetName())) { update(setCluster(get(), action.getCluster())); } ApproveVdsParameters params = new ApproveVdsParameters(guid); params = (ApproveVdsParameters) getMapper (Action.class, VdsOperationActionParameters.class).map(action, params); // Set pk authentication as default params.setAuthMethod(VdsOperationActionParameters.AuthenticationMethod.PublicKey); if (action.isSetRootPassword()) { params.setAuthMethod(VdsOperationActionParameters.AuthenticationMethod.Password); params.setRootPassword(action.getRootPassword()); } else if (action.isSetSsh() && action.getSsh().isSetAuthenticationMethod()) { if (action.getSsh().getAuthenticationMethod() == SshAuthenticationMethod.PASSWORD) { params.setAuthMethod(VdsOperationActionParameters.AuthenticationMethod.Password); if (action.getSsh().isSetUser() && action.getSsh().getUser().isSetPassword()) { params.setPassword(action.getSsh().getUser().getPassword()); } } } // by default activate the host after approval boolean activate = ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, BackendHostsResource.ACTIVATE, true, true); params.setActivateHost(activate); return doAction(ActionType.ApproveVds, params, action); }
to.setPassword(from.getPassword());
@Mapping(from = Host.class, to = VdsOperationActionParameters.class) public static VdsOperationActionParameters map(Host host, VdsOperationActionParameters params) { params.setPassword(host.getRootPassword()); if (host.isSetSsh()) { if (host.getSsh().isSetUser()) { if (host.getSsh().getUser().isSetPassword()) { // For backward compatibility giving priority to rootPassword field if (params.getPassword() == null) { params.setPassword(host.getSsh().getUser().getPassword()); } } if (host.getSsh().getUser().isSetUserName()) { params.getvds().setSshUsername(host.getSsh().getUser().getUserName()); } } if (host.getSsh().isSetPort()) { params.getvds().setSshPort(host.getSsh().getPort()); } if (host.getSsh().isSetFingerprint()) { params.getvds().setSshKeyFingerprint(host.getSsh().getFingerprint()); } if (host.getSsh().isSetAuthenticationMethod()) { params.setAuthMethod(mapSshAuthenticationMethod(host.getSsh().getAuthenticationMethod())); } } return params; }
params.setPassword(action.getSsh().getUser().getPassword());
params.setSysPrepPassword(vm.getDomain().getUser().getPassword());