Merge pull request #767 from resin-io/summit-fixes

Several small fixes
This commit is contained in:
CameronDiver 2018-10-18 15:46:15 +01:00 committed by GitHub
commit 8e0327662d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 8 deletions

View File

@ -501,6 +501,7 @@ export class Service {
) as ServiceConfig['networks'];
return {
name: `${this.serviceName}_${this.imageId}_${this.releaseId}`,
Tty: this.config.tty,
Cmd: this.config.command,
Volumes: volumes,
@ -608,10 +609,12 @@ export class Service {
// so that if we end up in a restart loop, we know exactly why
console.log(`Replacing container for service ${this.serviceName} because of config changes:`);
if (!nonArrayEquals) {
console.log(' Non-array fields: ', JSON.stringify(diff(
thisOmitted,
otherOmitted,
)));
// Try not to leak any sensitive information
const diffObj = diff(thisOmitted, otherOmitted) as ServiceConfig;
if (diffObj.environment != null) {
diffObj.environment = _.mapValues(diffObj.environment, () => 'hidden');
}
console.log(' Non-array fields: ', JSON.stringify(diffObj));
}
if (differentArrayFields.length > 0) {
console.log(' Array Fields: ', differentArrayFields.join(','));

View File

@ -458,5 +458,5 @@ export function normalizeLabels(
});
const balenaLabels = _.pickBy(labels, (_v, k) => _.startsWith(k, 'io.balena.'));
const otherLabels = _.pickBy(labels, (_v, k) => !(_.startsWith(k, 'io.balena.') || _.startsWith(k, 'io.resin.')));
return _.assign({}, otherLabels, legacyLabels, balenaLabels);
return _.assign({}, otherLabels, legacyLabels, balenaLabels) as { [key: string]: string };
}

View File

@ -119,7 +119,7 @@ class Config extends EventEmitter {
})
.then((value) => {
const schemaEntry = this.schema[key];
if (value == null && schemaEntry != null && schemaEntry.default) {
if (value == null && schemaEntry != null && schemaEntry.default != null) {
return schemaEntry.default;
}
return value;

View File

@ -490,7 +490,6 @@ module.exports = class DeviceState extends EventEmitter
triggerApplyTarget: ({ force = false, delay = 0, initial = false } = {}) =>
if @applyInProgress
console.log('==> Apply in progress')
if !@scheduledApply?
@scheduledApply = { force, delay }
else
@ -506,7 +505,6 @@ module.exports = class DeviceState extends EventEmitter
console.log('Applying target state')
@applyTarget({ force, initial })
.finally =>
console.log('==> Done applying target state!')
@applyInProgress = false
@reportCurrentState()
if @scheduledApply?