mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-23 23:42:29 +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 => {
|
||||
log.error(`Could not store target state for device: ${e}`);
|
||||
this.logger.logSystemMessage(
|
||||
`Could not move to new release: ${e.message}`,
|
||||
{},
|
||||
'targetStateRejection',
|
||||
false,
|
||||
);
|
||||
// the dashboard does not display lines correctly,
|
||||
// split them explcitly here
|
||||
const lines = e.message.split(/\r?\n/);
|
||||
lines[0] = `Could not move to new release: ${lines[0]}`;
|
||||
for (const line of lines) {
|
||||
this.logger.logSystemMessage(line, {}, 'targetStateRejection', false);
|
||||
}
|
||||
})
|
||||
.tapCatch(
|
||||
(e: unknown) =>
|
||||
|
@ -695,7 +695,7 @@ module.exports = class ApplicationManager extends EventEmitter
|
||||
_.each app.services, (s) ->
|
||||
if s.contract?
|
||||
try
|
||||
validateContract(s)
|
||||
validateContract(s.contract)
|
||||
catch e
|
||||
throw new ContractValidationError(s.serviceName, e.message)
|
||||
serviceContracts[s.serviceName] = s.contract
|
||||
|
Loading…
Reference in New Issue
Block a user