apps: move to error state if a volume is unavailable

This commit is contained in:
Girish Ramakrishnan
2026-02-28 01:02:22 +01:00
parent d5a729a2ba
commit cd89883dbb

View File

@@ -186,6 +186,8 @@ async function getVolumeMounts(app) {
for (const mount of app.mounts) {
const volume = volumesById[mount.volumeId];
const status = await volumes.getStatus(volume);
if (status.state !== 'active') throw new BoxError(BoxError.BAD_STATE, `Volume "${volume.name}" is not active. ${status.message}`);
mounts.push({
Source: volume.hostPath,
@@ -208,6 +210,11 @@ async function getAddonMounts(app) {
for (const addon of Object.keys(addons)) {
switch (addon) {
case 'localstorage': {
if (app.storageVolumeId) {
const volume = await volumes.get(app.storageVolumeId);
const status = await volumes.getStatus(volume);
if (status.state !== 'active') throw new BoxError(BoxError.BAD_STATE, `Storage volume "${volume.name}" is not active. ${status.message}`);
}
const storageDir = await apps.getStorageDir(app);
mounts.push({
Target: '/app/data',