mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-24 15:56:40 +00:00
Correctly validate container contracts
Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
5b48f791d9
commit
d16403f654
@ -589,12 +589,13 @@ export class APIBinder {
|
|||||||
})
|
})
|
||||||
.tapCatch(ContractValidationError, ContractViolationError, e => {
|
.tapCatch(ContractValidationError, ContractViolationError, e => {
|
||||||
log.error(`Could not store target state for device: ${e}`);
|
log.error(`Could not store target state for device: ${e}`);
|
||||||
this.logger.logSystemMessage(
|
// the dashboard does not display lines correctly,
|
||||||
`Could not move to new release: ${e.message}`,
|
// split them explcitly here
|
||||||
{},
|
const lines = e.message.split(/\r?\n/);
|
||||||
'targetStateRejection',
|
lines[0] = `Could not move to new release: ${lines[0]}`;
|
||||||
false,
|
for (const line of lines) {
|
||||||
);
|
this.logger.logSystemMessage(line, {}, 'targetStateRejection', false);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.tapCatch(
|
.tapCatch(
|
||||||
(e: unknown) =>
|
(e: unknown) =>
|
||||||
|
@ -695,7 +695,7 @@ module.exports = class ApplicationManager extends EventEmitter
|
|||||||
_.each app.services, (s) ->
|
_.each app.services, (s) ->
|
||||||
if s.contract?
|
if s.contract?
|
||||||
try
|
try
|
||||||
validateContract(s)
|
validateContract(s.contract)
|
||||||
catch e
|
catch e
|
||||||
throw new ContractValidationError(s.serviceName, e.message)
|
throw new ContractValidationError(s.serviceName, e.message)
|
||||||
serviceContracts[s.serviceName] = s.contract
|
serviceContracts[s.serviceName] = s.contract
|
||||||
|
Loading…
Reference in New Issue
Block a user