зеркало из https://github.com/docker/kitematic.git
Better error reports around docker-machine
Signed-off-by: Jeffrey Morgan <jmorganca@gmail.com>
This commit is contained in:
Родитель
5426eeaafd
Коммит
7b7f1d3870
|
@ -16,6 +16,7 @@ var MenuTemplate = function () {
|
|||
submenu: [
|
||||
{
|
||||
label: 'About Kitematic',
|
||||
enabled: !!docker.host,
|
||||
click: function () {
|
||||
metrics.track('Opened About', {
|
||||
from: 'menu'
|
||||
|
|
|
@ -24,11 +24,11 @@ var DockerMachine = {
|
|||
version: function () {
|
||||
return util.exec([this.command(), '-v']).then(stdout => {
|
||||
try {
|
||||
let tokens = stdout.split(' ');
|
||||
if (tokens.length < 3) {
|
||||
return Promise.resolve(null);
|
||||
var match = stdout.match(/(\d+\.\d+\.\d+).*/);
|
||||
if (!match || match.length < 2) {
|
||||
Promise.reject('docker-machine -v output format not recognized.');
|
||||
}
|
||||
return Promise.resolve(tokens[2]);
|
||||
return Promise.resolve(match[1]);
|
||||
} catch (err) {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ var DockerMachine = {
|
|||
util.exec('start powershell.exe ' + cmd,
|
||||
{env: {
|
||||
'DOCKER_HOST': machineUrl,
|
||||
'DOCKER_CERT_PATH': path.join(util.home(), '.docker/machine/machines/' + machineName),
|
||||
'DOCKER_CERT_PATH': path.join(util.home(), '.docker', 'machine', 'machines', machineName),
|
||||
'DOCKER_TLS_VERIFY': 1
|
||||
}
|
||||
});
|
||||
|
@ -157,6 +157,14 @@ var DockerMachine = {
|
|||
util.exec([path.join(process.env.RESOURCES_PATH, 'terminal'), `DOCKER_HOST=${machineUrl} DOCKER_CERT_PATH=${path.join(util.home(), '.docker/machine/machines/' + machineName)} DOCKER_TLS_VERIFY=1 ${cmd}`]).then(() => {});
|
||||
});
|
||||
}
|
||||
},
|
||||
virtualBoxLogs: function (machineName = this.name()) {
|
||||
let logsPath = path.join(util.home(), '.docker', 'machine', 'machines', machineName, machineName, 'Logs', 'VBox.log');
|
||||
if (fs.existsSync(logsPath)) {
|
||||
return fs.readFileSync(logsPath, 'utf8');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -52,14 +52,8 @@ export default {
|
|||
},
|
||||
|
||||
async setup () {
|
||||
let virtualBoxVersion = await virtualBox.version();
|
||||
let machineVersion = await machine.version();
|
||||
|
||||
metrics.track('Started Setup', {
|
||||
virtualBoxVersion,
|
||||
machineVersion
|
||||
});
|
||||
|
||||
let virtualBoxVersion = null;
|
||||
let machineVersion = null;
|
||||
while (true) {
|
||||
try {
|
||||
setupServerActions.started({started: false});
|
||||
|
@ -79,7 +73,15 @@ export default {
|
|||
continue;
|
||||
}
|
||||
|
||||
virtualBoxVersion = await virtualBox.version();
|
||||
machineVersion = await machine.version();
|
||||
|
||||
setupServerActions.started({started: true});
|
||||
metrics.track('Started Setup', {
|
||||
virtualBoxVersion,
|
||||
machineVersion
|
||||
});
|
||||
|
||||
let exists = await virtualBox.vmExists(machine.name()) && fs.existsSync(path.join(util.home(), '.docker', 'machine', 'machines', machine.name()));
|
||||
if (!exists) {
|
||||
router.get().transitionTo('setup');
|
||||
|
@ -128,10 +130,18 @@ export default {
|
|||
machineVersion
|
||||
});
|
||||
setupServerActions.error({error});
|
||||
bugsnag.notify('SetupError', error.message, {
|
||||
error: error,
|
||||
output: error.message
|
||||
|
||||
let message = error.message.split('\n');
|
||||
let lastLine = message.length > 1 ? message[message.length - 2] : 'Docker Machine encountered an error.';
|
||||
let virtualBoxLogs = machine.virtualBoxLogs();
|
||||
bugsnag.notify('Setup Failed', lastLine, {
|
||||
'Docker Machine Logs': error.message,
|
||||
'VirtualBox Logs': virtualBoxLogs,
|
||||
'VirtualBox Version': virtualBoxVersion,
|
||||
'Machine Version': machineVersion,
|
||||
groupingHash: machineVersion
|
||||
}, 'info');
|
||||
|
||||
this.clearTimers();
|
||||
await this.pause();
|
||||
}
|
||||
|
|
|
@ -16,27 +16,20 @@ var VirtualBox = {
|
|||
}
|
||||
},
|
||||
installed: function () {
|
||||
if (util.isWindows()) {
|
||||
return (process.env.VBOX_MSI_INSTALL_PATH && fs.existsSync(path.join(process.env.VBOX_MSI_INSTALL_PATH, 'VBoxManage.exe'))) ||
|
||||
(process.env.VBOX_INSTALL_PATH && fs.existsSync(path.join(process.env.VBOX_INSTALL_PATH, 'VBoxManage.exe')));
|
||||
} else {
|
||||
return fs.existsSync('/Applications/VirtualBox.app') && fs.existsSync('/Applications/VirtualBox.app/Contents/MacOS/VBoxManage');
|
||||
}
|
||||
return fs.existsSync(this.command());
|
||||
},
|
||||
active: function () {
|
||||
return fs.existsSync('/dev/vboxnetctl');
|
||||
},
|
||||
version: function () {
|
||||
return new Promise((resolve, reject) => {
|
||||
util.exec([this.command(), '-v']).then(stdout => {
|
||||
var match = stdout.match(/(\d+\.\d+\.\d+).*/);
|
||||
if (!match || match.length < 2) {
|
||||
reject('VBoxManage -v output format not recognized.');
|
||||
}
|
||||
resolve(match[1]);
|
||||
}).catch(() => {
|
||||
resolve(null);
|
||||
});
|
||||
return util.exec([this.command(), '-v']).then(stdout => {
|
||||
var match = stdout.match(/(\d+\.\d+\.\d+).*/);
|
||||
if (!match || match.length < 2) {
|
||||
Promise.reject('VBoxManage -v output format not recognized.');
|
||||
}
|
||||
return Promise.resolve(match[1]);
|
||||
}).catch(() => {
|
||||
return Promise.resolve(null);
|
||||
});
|
||||
},
|
||||
poweroffall: function () {
|
||||
|
|
|
@ -33,9 +33,6 @@ var WebUtil = {
|
|||
bugsnag.releaseStage = process.env.NODE_ENV === 'development' ? 'development' : 'production';
|
||||
bugsnag.notifyReleaseStages = ['production'];
|
||||
bugsnag.appVersion = app.getVersion();
|
||||
bugsnag.metaData = {
|
||||
beta: !!settingsjson.beta
|
||||
};
|
||||
|
||||
bugsnag.beforeNotify = function(payload) {
|
||||
if (!metrics.enabled()) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче