You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Msp dashboard: Update error handling in software-related actions (#23065)
For: fleetdm/confidential#8473
Changes:
- Updated the cloud error components message
- Updated the upload-software action to log errors about failed requests
to the Fleet API
- Updated the edit-software action to log errors about failed requests
to the Fleet API, and to delete temporary files when requests fail.
- Updated the software page to clear cloud errors when modals are
closed.
Copy file name to clipboardExpand all lines: ee/bulk-operations-dashboard/api/controllers/software/edit-software.js
+14-2Lines changed: 14 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -160,9 +160,15 @@ module.exports = {
160
160
};
161
161
},
162
162
})
163
-
.intercept((error)=>{
163
+
.intercept(async(error)=>{
164
164
// Note: with this current behavior, all errors from this upload are currently swallowed and a softwareUploadFailed response is returned.
165
165
// FUTURE: Test to make sure that uploading duplicate software to a team results in a 409 response.
166
+
// Before handline errors, decide what to do about the file uploaded to s3, if this is undeployed software, we'll leave it alone, but if this was a temporary file created to transfer it between teams on the Fleet instance, we'll delete the file.
167
+
if(!software.id){// If the software does not have an ID, it not stored in the app's database/s3 bucket, so we can safely delete the file in s3.
sails.log.warn(`When attempting to upload a software installer, an unexpected error occurred communicating with the Fleet API, ${require('util').inspect(error,{depth: 0})}`);
166
172
return{'softwareUploadFailed': error};
167
173
});
168
174
// console.timeEnd(`transfering ${software.name} to fleet instance for team id ${team}`);
@@ -229,9 +235,15 @@ module.exports = {
229
235
};
230
236
},
231
237
})
232
-
.intercept((error)=>{
238
+
.intercept(async(error)=>{
233
239
// Note: with this current behavior, all errors from this upload are currently swallowed and a softwareUploadFailed response is returned.
234
240
// FUTURE: Test to make sure that uploading duplicate software to a team results in a 409 response.
241
+
// Before handling errors, decide what to do about the file uploaded to s3, if this is undeployed software, we'll leave it alone, but if this was a temporary file created to transfer it between teams on the Fleet instance, we'll delete the file.
sails.log.warn(`When attempting to upload a software installer, an unexpected error occurred communicating with the Fleet API, ${require('util').inspect(error,{depth: 0})}`);
235
247
return{'softwareUploadFailed': error};
236
248
});
237
249
// console.timeEnd(`transfering ${software.name} to fleet instance for team id ${teamApid}`);
sails.log.warn(`When attempting to upload a software installer, an unexpected error occurred communicating with the Fleet API, ${require('util').inspect(error,{depth: 0})}`);
110
+
return{'softwareUploadFailed': error};
101
111
});
102
112
}
103
113
// Remove the file from the s3 bucket after it has been sent to the Fleet server.
<p :class="{ 'm-0': beWithoutMargins }" class="text-danger"><slot name="default">An error occured while processing your request. Please check your information and try again, or <a href="/contact">contact support</a> if the error persists.</slot></p>
46
+
<p :class="{ 'm-0': beWithoutMargins }" class="text-danger"><slot name="default">An unexpected error occurred communicating with the Fleet API</slot></p>
0 commit comments