little fix: fail outside of socket connection

single-host
Marc Wäckerlin 8 years ago
parent ecba312335
commit 702a064814
  1. 7
      ChangeLog
  2. 10
      nodejs/sockets/index.js

@ -1,3 +1,10 @@
2016-01-31 21:58 marc
* ChangeLog, nodejs/docker/docker.js,
nodejs/public/javascripts/servicedock.js,
nodejs/public/stylesheets/servicedock.css,
nodejs/views/index.ejs: create works
2016-01-29 15:55 marc
* nodejs/docker/docker.js,

@ -17,6 +17,10 @@ module.exports = function(io) {
proc.exec(cmd, callback);
}
function fail(txt, data) {
console.log("** "+txt, data);
}
var oldcontainer = null;
function containerinspect(error, stdout, stderr) {
if (error || stderr)
@ -96,7 +100,7 @@ module.exports = function(io) {
function modify(cmd, name) {
if (!name.match(/^[a-z0-9][-_:.+a-z0-9]*$/i))
return fail("illegal instance name");
return this.fail("illegal instance name");
exec("docker "+cmd+" "+name, updatecontainers);
}
@ -104,7 +108,7 @@ module.exports = function(io) {
if (cmds.length>0)
exec(cmds.shift(), function(error, stdout, stderr) {
if (error || stderr)
return fail("create container failed", {
return this.fail("create container failed", {
error: error, stderr: stderr, stdout: stdout
});
createContainer(cmds);
@ -175,7 +179,7 @@ module.exports = function(io) {
function new_bash(name) {
if (!name.match(/^[a-z0-9][-_:.+a-z0-9]*$/i))
return fail("illegal instance name");
return this.fail("illegal instance name");
if (bash_connections[name]) return;
bash_connections[name] =
pty.spawn("docker", ["exec", "-it", name, "bash", "-i"]);

Loading…
Cancel
Save