-
Notifications
You must be signed in to change notification settings - Fork 68
Open
Labels
cockpit-image-builderCan be reproduces in image builder plugin in CockpitCan be reproduces in image builder plugin in Cockpit
Description
The following lines could potentially cause an error that throws an error causing the loop to break and only one item being read
if the file is not found or if the file somehow gets corrupt. This means the loop will exit early and we might not get all the compose statuses we're looking for.
image-builder-frontend/src/store/cockpit/cockpitApi.ts
Lines 743 to 745 in 435d3d9
| const request = await cockpit | |
| .file(path.join(blueprintsDir, bpEntry[0], queryArg.composeId)) | |
| .read(); |
Expected Behavior
The loop should continue searching other blueprint directories if the compose file
isn't found in the current one.
Suggested Fix
Wrap the file read in a try-catch and continue the loop on error.
for (const bpEntry of entries) {
try {
const request = await cockpit
.file(path.join(blueprintsDir, bpEntry[0], queryArg.composeId))
.read();
return {
data: {
image_status: data.image_status,
request: JSON.parse(request),
},
};
} catch {
// File not found in this blueprint directory, continue searching
continue;
}
}JIRA: HMS-10350
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
cockpit-image-builderCan be reproduces in image builder plugin in CockpitCan be reproduces in image builder plugin in Cockpit