apps: move to error state if a volume is unavailable
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user