Dont try to set the commit if it's undefined

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
Cameron Diver 2019-07-05 11:31:20 +01:00
parent 1690171304
commit bb549a445b
2 changed files with 4 additions and 4 deletions

View File

@ -622,7 +622,7 @@ module.exports = class ApplicationManager extends EventEmitter
pairSteps = @_nextStepsForVolume(pair, currentApp, removePairs.concat(updatePairs))
steps = steps.concat(pairSteps)
if _.isEmpty(steps) and currentApp.commit != targetApp.commit
if _.isEmpty(steps) and targetApp.commit? and currentApp.commit != targetApp.commit
steps.push({
action: 'updateCommit'
target: targetApp.commit

View File

@ -159,7 +159,7 @@ export class Config extends (EventEmitter as new () => ConfigEventEmitter) {
// if we have anything other than a string, it must be converted to
// a string before being stored in the db
const strValue = Config.valueToString(value);
const strValue = Config.valueToString(value, key);
if (oldValues[key] !== value) {
return this.db.upsertModel(
@ -336,7 +336,7 @@ export class Config extends (EventEmitter as new () => ConfigEventEmitter) {
});
}
private static valueToString(value: unknown) {
private static valueToString(value: unknown, name: string) {
switch (typeof value) {
case 'object':
return JSON.stringify(value);
@ -346,7 +346,7 @@ export class Config extends (EventEmitter as new () => ConfigEventEmitter) {
return value.toString();
default:
throw new InternalInconsistencyError(
`Could not convert configuration value to string for storage, value: ${value}, type: ${typeof value}`,
`Could not convert configuration value to string for storage, name: ${name}, value: ${value}, type: ${typeof value}`,
);
}
}