mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-19 05:37:53 +00:00
Apply coffeelint everywhere
This commit is contained in:
parent
c52c2c0bd9
commit
1eb31ce5f6
@ -205,7 +205,7 @@ exports.start = start = (app) ->
|
|||||||
ports[port + '/tcp'] = [ HostPort: port ]
|
ports[port + '/tcp'] = [ HostPort: port ]
|
||||||
container.startAsync(
|
container.startAsync(
|
||||||
Privileged: true
|
Privileged: true
|
||||||
NetworkMode: "host"
|
NetworkMode: 'host'
|
||||||
PortBindings: ports
|
PortBindings: ports
|
||||||
Binds: [
|
Binds: [
|
||||||
'/resin-data/' + app.appId + ':/data'
|
'/resin-data/' + app.appId + ':/data'
|
||||||
@ -257,15 +257,15 @@ exports.lockAndKill = lockAndKill = (app, force) ->
|
|||||||
.catch (err) ->
|
.catch (err) ->
|
||||||
if err.code != 'ENOENT'
|
if err.code != 'ENOENT'
|
||||||
locked[app.appId] = false
|
locked[app.appId] = false
|
||||||
message = 'Updates are locked by application'
|
err = new Error('Updates are locked by application')
|
||||||
logSystemEvent(logTypes.stopAppError, app, { message })
|
logSystemEvent(logTypes.stopAppError, app, err)
|
||||||
throw message
|
throw err
|
||||||
.then ->
|
.then ->
|
||||||
kill(app)
|
kill(app)
|
||||||
|
|
||||||
exports.startAndUnlock = startAndUnlock = (app) ->
|
exports.startAndUnlock = startAndUnlock = (app) ->
|
||||||
Promise.try ->
|
Promise.try ->
|
||||||
throw "Cannot start app because we couldn't acquire lock" if locked[app.appId] == false
|
throw new Error("Cannot start app because we couldn't acquire lock") if locked[app.appId] == false
|
||||||
.then ->
|
.then ->
|
||||||
locked[app.appId] = null
|
locked[app.appId] = null
|
||||||
start(app)
|
start(app)
|
||||||
|
@ -114,7 +114,7 @@ do ->
|
|||||||
return false
|
return false
|
||||||
|
|
||||||
# Get the id of an image on a given registry and tag.
|
# Get the id of an image on a given registry and tag.
|
||||||
getImageId = (registry, imageName, tag='latest') ->
|
getImageId = (registry, imageName, tag = 'latest') ->
|
||||||
request.getAsync("http://#{registry}/v1/repositories/#{imageName}/tags")
|
request.getAsync("http://#{registry}/v1/repositories/#{imageName}/tags")
|
||||||
.spread (res, data) ->
|
.spread (res, data) ->
|
||||||
if res.statusCode == 404
|
if res.statusCode == 404
|
||||||
@ -152,7 +152,7 @@ do ->
|
|||||||
# The object returned has layer ids as keys and their download size as values.
|
# The object returned has layer ids as keys and their download size as values.
|
||||||
# Download size is the size that docker will download if the image will be pulled now.
|
# Download size is the size that docker will download if the image will be pulled now.
|
||||||
# If some layer is already downloaded, it will return 0 size for that layer.
|
# If some layer is already downloaded, it will return 0 size for that layer.
|
||||||
getLayerDownloadSizes = (image, tag='latest') ->
|
getLayerDownloadSizes = (image, tag = 'latest') ->
|
||||||
{registry, imageName} = getRegistryAndName(image)
|
{registry, imageName} = getRegistryAndName(image)
|
||||||
imageSizes = {}
|
imageSizes = {}
|
||||||
getImageId(registry, imageName, tag)
|
getImageId(registry, imageName, tag)
|
||||||
@ -180,11 +180,11 @@ do ->
|
|||||||
getRegistryAndName = (image) ->
|
getRegistryAndName = (image) ->
|
||||||
[ m, registry, imageName ] = image.match(/(.+[:.].+)\/(.+\/.+)/)
|
[ m, registry, imageName ] = image.match(/(.+[:.].+)\/(.+\/.+)/)
|
||||||
if not registry
|
if not registry
|
||||||
throw new Error("Expected image name to include registry domain name")
|
throw new Error('Expected image name to include registry domain name')
|
||||||
if not imageName
|
if not imageName
|
||||||
throw new Error("Invalid image name, expected domain.tld/repo/image format.")
|
throw new Error('Invalid image name, expected domain.tld/repo/image format.')
|
||||||
return {registry, imageName}
|
return {registry, imageName}
|
||||||
|
|
||||||
# Create a stream that transforms `docker.modem.followProgress` onProgress events
|
# Create a stream that transforms `docker.modem.followProgress` onProgress events
|
||||||
# to include total progress metrics.
|
# to include total progress metrics.
|
||||||
pullProgress = (image, onProgress) ->
|
pullProgress = (image, onProgress) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user