Fixing bug where docker-machine create would fail if ssh is not on path

This commit is contained in:
Jeffrey Morgan 2015-06-16 12:06:34 -07:00
Родитель 93f532f7df
Коммит f8448dff75
3 изменённых файлов: 14 добавлений и 9 удалений

Просмотреть файл

@ -153,7 +153,7 @@ module.exports = function (grunt) {
files: [{ files: [{
expand: true, expand: true,
cwd: 'resources', cwd: 'resources',
src: ['docker*'], src: ['docker*', 'boot2docker.iso', 'ssh.exe', 'OPENSSH_LICENSE'],
dest: 'dist/Kitematic-win32/resources/resources/' dest: 'dist/Kitematic-win32/resources/resources/'
}], }],
options: { options: {
@ -164,7 +164,7 @@ module.exports = function (grunt) {
files: [{ files: [{
expand: true, expand: true,
cwd: 'resources', cwd: 'resources',
src: ['**/*'], src: ['docker*', 'boot2docker.iso', 'macsudo', 'terminal'],
dest: '<%= OSX_FILENAME %>/Contents/Resources/resources/' dest: '<%= OSX_FILENAME %>/Contents/Resources/resources/'
}, { }, {
src: 'util/kitematic.icns', src: 'util/kitematic.icns',

Просмотреть файл

@ -58,9 +58,9 @@ var DockerMachine = {
create: function () { create: function () {
var dockerversion = util.packagejson()['docker-version']; var dockerversion = util.packagejson()['docker-version'];
if (util.isWindows()) { if (util.isWindows()) {
return util.exec([this.command(), '--native-ssh', '-D', 'create', '-d', 'virtualbox', '--virtualbox-boot2docker-url', path.join(process.cwd(), 'resources', 'boot2docker-' + dockerversion + '.iso'), '--virtualbox-memory', '2048', NAME]); return util.exec([this.command(), '-D', 'create', '-d', 'virtualbox', '--virtualbox-memory', '2048', NAME]);
} else { } else {
return util.exec([this.command(), '-D', 'create', '-d', 'virtualbox', '--virtualbox-boot2docker-url', path.join(process.cwd(), 'resources', 'boot2docker-' + dockerversion + '.iso'), '--virtualbox-memory', '2048', NAME]); return util.exec([this.command(), '-D', 'create', '-d', 'virtualbox' ,'--virtualbox-boot2docker-url', path.join(process.cwd(), 'resources', 'boot2docker-' + dockerversion + '.iso'), '--virtualbox-memory', '2048', NAME]);
} }
}, },
start: function () { start: function () {
@ -161,8 +161,7 @@ var DockerMachine = {
{env: { {env: {
'DOCKER_HOST' : machine.url, 'DOCKER_HOST' : machine.url,
'DOCKER_CERT_PATH' : path.join(util.home(), '.docker/machine/machines/' + machine.name), 'DOCKER_CERT_PATH' : path.join(util.home(), '.docker/machine/machines/' + machine.name),
'DOCKER_TLS_VERIFY': 1, 'DOCKER_TLS_VERIFY': 1
'PATH': resources.resourceDir() + ';' + process.env.PATH
} }
}); });
}); });
@ -174,9 +173,6 @@ var DockerMachine = {
}); });
} }
}, },
exec: function () {
}
}; };
module.exports = DockerMachine; module.exports = DockerMachine;

Просмотреть файл

@ -10,6 +10,15 @@ var app = remote.require('app');
module.exports = { module.exports = {
exec: function (args, options) { exec: function (args, options) {
options = options || {}; options = options || {};
// Add resources dir to exec path for Windows
if (this.isWindows()) {
options.env = options.env || {};
if (!options.env.PATH) {
options.env.PATH = process.env.RESOURCES_PATH + ';' + process.env.PATH;
}
}
let fn = Array.isArray(args) ? exec : child_process.exec; let fn = Array.isArray(args) ? exec : child_process.exec;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
fn(args, options, (stderr, stdout, code) => { fn(args, options, (stderr, stdout, code) => {