mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-04-16 15:28:52 +00:00
Improve UX when apps.json is not present
Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
f56be737ee
commit
ce543d820f
@ -13,6 +13,7 @@ validation = require './lib/validation'
|
||||
systemd = require './lib/systemd'
|
||||
updateLock = require './lib/update-lock'
|
||||
{ singleToMulticontainerApp } = require './lib/migration'
|
||||
{ ENOENT, EISDIR } = require './lib/errors'
|
||||
|
||||
DeviceConfig = require './device-config'
|
||||
ApplicationManager = require './application-manager'
|
||||
@ -383,6 +384,12 @@ module.exports = class DeviceState extends EventEmitter
|
||||
commit: commitToPin,
|
||||
app: appToPin,
|
||||
}
|
||||
# Ensure that this is actually a file, and not an empty path
|
||||
# It can be an empty path because if the file does not exist
|
||||
# on host, the docker daemon creates an empty directory when
|
||||
# the bind mount is added
|
||||
.catch ENOENT, EISDIR, ->
|
||||
console.log('No apps.json file present, skipping preload')
|
||||
.catch (err) =>
|
||||
@eventTracker.track('Loading preloaded apps failed', { error: err })
|
||||
|
||||
|
@ -25,6 +25,10 @@ export function EEXIST(err: CodedSysError): boolean {
|
||||
return err.code === 'EEXIST';
|
||||
}
|
||||
|
||||
export function EISDIR(err: CodedSysError): boolean {
|
||||
return err.code === 'EISDIR';
|
||||
}
|
||||
|
||||
export function UnitNotLoadedError(err: string[]): boolean {
|
||||
return endsWith(err[0], 'not loaded.');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user