fix(striker-ui-api): make input fallbacks consistent in prepare host

main
Tsu-ba-me 1 year ago
parent 80108dd43e
commit 49e68874fe
  1. 6
      striker-ui-api/src/lib/request_handlers/host/prepareHost.ts

@ -27,7 +27,7 @@ export const prepareHost: RequestHandler<
hostPassword, hostPassword,
hostSSHPort, hostSSHPort,
hostType, hostType,
hostUser = 'root', hostUser,
hostUUID, hostUUID,
redhatPassword, redhatPassword,
redhatUser, redhatUser,
@ -43,10 +43,10 @@ export const prepareHost: RequestHandler<
const dataHostIPAddress = sanitize(hostIPAddress, 'string'); const dataHostIPAddress = sanitize(hostIPAddress, 'string');
const dataHostName = sanitize(hostName, 'string'); const dataHostName = sanitize(hostName, 'string');
const dataHostPassword = sanitize(hostPassword, 'string'); const dataHostPassword = sanitize(hostPassword, 'string');
const dataHostSSHPort = sanitize(hostSSHPort, 'number') || 22; const dataHostSSHPort = sanitize(hostSSHPort, 'number', { fallback: 22 });
const dataHostType = sanitize(hostType, 'string'); const dataHostType = sanitize(hostType, 'string');
// Host user is unused at the moment. // Host user is unused at the moment.
const dataHostUser = sanitize(hostUser, 'string'); const dataHostUser = sanitize(hostUser, 'string', { fallback: 'root' });
const dataHostUUID = sanitize(hostUUID, 'string'); const dataHostUUID = sanitize(hostUUID, 'string');
const dataRedhatPassword = sanitize(redhatPassword, 'string'); const dataRedhatPassword = sanitize(redhatPassword, 'string');
const dataRedhatUser = sanitize(redhatUser, 'string'); const dataRedhatUser = sanitize(redhatUser, 'string');

Loading…
Cancel
Save