Remove pruneInfraImages out of platform startup

If it fails, it's really OK. Maybe we will have a button to remove
images.

This goes further into step of webadmin always staying up and not
crashing/erroring for cosmetic issues.
This commit is contained in:
Girish Ramakrishnan
2018-11-17 19:34:34 -08:00
parent fd4057df94
commit 5c9b6736f0
2 changed files with 25 additions and 9 deletions

View File

@@ -2,6 +2,7 @@
exports = module.exports = {
spawn: spawn,
exec: exec,
execSync: execSync,
sudo: sudo,
sudoSync: sudoSync
@@ -29,6 +30,21 @@ function execSync(tag, cmd, callback) {
if (callback) callback();
}
function exec(tag, cmd, callback) {
assert.strictEqual(typeof tag, 'string');
assert.strictEqual(typeof cmd, 'string');
assert.strictEqual(typeof callback, 'function');
debug(`${tag} exec: ${cmd}`);
child_process.execSync(cmd, function (error, stdout, stderr) {
debug(`${tag} (stdout): %s`, stdout.toString('utf8'));
debug(`${tag} (stderr): %s`, stderr.toString('utf8'));
callback(error);
});
}
function spawn(tag, file, args, options, callback) {
assert.strictEqual(typeof tag, 'string');
assert.strictEqual(typeof file, 'string');
@@ -38,7 +54,7 @@ function spawn(tag, file, args, options, callback) {
callback = once(callback); // exit may or may not be called after an 'error'
debug(tag + ' execFile: %s %s', file, args.join(' '));
debug(tag + ' spawn: %s %s', file, args.join(' '));
var cp = child_process.spawn(file, args, options);
if (options.logStream) {
@@ -50,7 +66,7 @@ function spawn(tag, file, args, options, callback) {
});
cp.stderr.on('data', function (data) {
debug(tag + ' (stderr): %s', data.toString('utf8'));
debug(tag + ' (stdout): %s', data.toString('utf8'));
});
}