fix(striker-ui-api): correct left join variables in select host detail

main
Tsu-ba-me 1 year ago
parent 39cba349bd
commit 20b782d50c
  1. 12
      striker-ui-api/src/lib/request_handlers/host/buildQueryHostDetail.ts

@ -42,7 +42,7 @@ const setCvar = (
export const buildQueryHostDetail: BuildQueryDetailFunction = ({ export const buildQueryHostDetail: BuildQueryDetailFunction = ({
keys: hostUUIDs = '*', keys: hostUUIDs = '*',
} = {}) => { } = {}) => {
const condHostUUIDs = buildKnownIDCondition(hostUUIDs, 'AND a.host_uuid'); const condHostUUIDs = buildKnownIDCondition(hostUUIDs, 'a.host_uuid');
stdout(`condHostUUIDs=[${condHostUUIDs}]`); stdout(`condHostUUIDs=[${condHostUUIDs}]`);
@ -66,15 +66,15 @@ export const buildQueryHostDetail: BuildQueryDetailFunction = ({
FROM hosts AS a FROM hosts AS a
LEFT JOIN variables AS b LEFT JOIN variables AS b
ON b.variable_source_uuid = a.host_uuid ON b.variable_source_uuid = a.host_uuid
AND (
b.variable_name LIKE '${CVAR_PREFIX}%'
OR b.variable_name = 'install-target::enabled'
)
LEFT JOIN network_interfaces AS c LEFT JOIN network_interfaces AS c
ON b.variable_name LIKE '%link%_mac%' ON b.variable_name LIKE '%link%_mac%'
AND b.variable_value = c.network_interface_mac_address AND b.variable_value = c.network_interface_mac_address
AND a.host_uuid = c.network_interface_host_uuid AND a.host_uuid = c.network_interface_host_uuid
WHERE ( WHERE ${condHostUUIDs}
variable_name LIKE '${CVAR_PREFIX}%'
OR variable_name = 'install-target::enabled'
)
${condHostUUIDs}
ORDER BY cvar_name ASC, ORDER BY cvar_name ASC,
b.variable_name ASC;`; b.variable_name ASC;`;

Loading…
Cancel
Save