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']; ) as ServiceConfig['networks'];
return { return {
name: `${this.serviceName}_${this.imageId}_${this.releaseId}`,
Tty: this.config.tty, Tty: this.config.tty,
Cmd: this.config.command, Cmd: this.config.command,
Volumes: volumes, Volumes: volumes,
@ -608,10 +609,12 @@ export class Service {
// so that if we end up in a restart loop, we know exactly why // 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:`); console.log(`Replacing container for service ${this.serviceName} because of config changes:`);
if (!nonArrayEquals) { if (!nonArrayEquals) {
console.log(' Non-array fields: ', JSON.stringify(diff( // Try not to leak any sensitive information
thisOmitted, const diffObj = diff(thisOmitted, otherOmitted) as ServiceConfig;
otherOmitted, if (diffObj.environment != null) {
))); diffObj.environment = _.mapValues(diffObj.environment, () => 'hidden');
}
console.log(' Non-array fields: ', JSON.stringify(diffObj));
} }
if (differentArrayFields.length > 0) { if (differentArrayFields.length > 0) {
console.log(' Array Fields: ', differentArrayFields.join(',')); 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 balenaLabels = _.pickBy(labels, (_v, k) => _.startsWith(k, 'io.balena.'));
const otherLabels = _.pickBy(labels, (_v, k) => !(_.startsWith(k, 'io.balena.') || _.startsWith(k, 'io.resin.'))); 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) => { .then((value) => {
const schemaEntry = this.schema[key]; const schemaEntry = this.schema[key];
if (value == null && schemaEntry != null && schemaEntry.default) { if (value == null && schemaEntry != null && schemaEntry.default != null) {
return schemaEntry.default; return schemaEntry.default;
} }
return value; return value;

View File

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