minor targetCli fix to work-around Ubuntu 18:04 bug
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
parent
d9bf3d7d2e
commit
3ab4023678
|
|
@ -353,7 +353,21 @@ delete ${iscsiName}
|
||||||
|
|
||||||
driver.ctx.logger.verbose("TargetCLI command: " + logCommand);
|
driver.ctx.logger.verbose("TargetCLI command: " + logCommand);
|
||||||
|
|
||||||
let response = await sshClient.exec(sshClient.buildCommand(command, args));
|
// https://github.com/democratic-csi/democratic-csi/issues/127
|
||||||
|
// https://bugs.launchpad.net/ubuntu/+source/python-configshell-fb/+bug/1776761
|
||||||
|
// can apply the linked patch with some modifications to overcome the
|
||||||
|
// KeyErrors or we can simply start a fake tty which does not seem to have
|
||||||
|
// a detrimental effect, only affects Ubuntu 18.04 and older
|
||||||
|
let options = {
|
||||||
|
pty: true,
|
||||||
|
};
|
||||||
|
let response = await sshClient.exec(
|
||||||
|
sshClient.buildCommand(command, args),
|
||||||
|
options
|
||||||
|
);
|
||||||
|
if (response.code != 0) {
|
||||||
|
throw new Error(response.stderr);
|
||||||
|
}
|
||||||
driver.ctx.logger.verbose(
|
driver.ctx.logger.verbose(
|
||||||
"TargetCLI response: " + JSON.stringify(response)
|
"TargetCLI response: " + JSON.stringify(response)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -33,25 +33,28 @@ class SshClient {
|
||||||
var conn = new Client();
|
var conn = new Client();
|
||||||
|
|
||||||
if (client.options.connection.debug == true) {
|
if (client.options.connection.debug == true) {
|
||||||
client.options.connection.debug = function(msg) {
|
client.options.connection.debug = function (msg) {
|
||||||
client.debug(msg);
|
client.debug(msg);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
conn
|
conn
|
||||||
.on("error", function(err) {
|
.on("error", function (err) {
|
||||||
client.debug("Client :: error");
|
client.debug("Client :: error");
|
||||||
reject(err);
|
reject(err);
|
||||||
})
|
})
|
||||||
.on("ready", function() {
|
.on("ready", function () {
|
||||||
client.debug("Client :: ready");
|
client.debug("Client :: ready");
|
||||||
conn.exec(command, options, function(err, stream) {
|
//options.pty = true;
|
||||||
|
//options.env = {
|
||||||
|
// TERM: "",
|
||||||
|
//};
|
||||||
|
conn.exec(command, options, function (err, stream) {
|
||||||
if (err) reject(err);
|
if (err) reject(err);
|
||||||
let stderr;
|
let stderr;
|
||||||
let stdout;
|
let stdout;
|
||||||
stream
|
stream
|
||||||
.on("close", function(code, signal) {
|
.on("close", function (code, signal) {
|
||||||
client.debug(
|
client.debug(
|
||||||
"Stream :: close :: code: " + code + ", signal: " + signal
|
"Stream :: close :: code: " + code + ", signal: " + signal
|
||||||
);
|
);
|
||||||
|
|
@ -61,7 +64,7 @@ class SshClient {
|
||||||
resolve({ stderr, stdout, code, signal });
|
resolve({ stderr, stdout, code, signal });
|
||||||
conn.end();
|
conn.end();
|
||||||
})
|
})
|
||||||
.on("data", function(data) {
|
.on("data", function (data) {
|
||||||
client.debug("STDOUT: " + data);
|
client.debug("STDOUT: " + data);
|
||||||
if (stream_proxy) {
|
if (stream_proxy) {
|
||||||
stream_proxy.stdout.emit("data", ...arguments);
|
stream_proxy.stdout.emit("data", ...arguments);
|
||||||
|
|
@ -71,7 +74,7 @@ class SshClient {
|
||||||
}
|
}
|
||||||
stdout = stdout.concat(data);
|
stdout = stdout.concat(data);
|
||||||
})
|
})
|
||||||
.stderr.on("data", function(data) {
|
.stderr.on("data", function (data) {
|
||||||
client.debug("STDERR: " + data);
|
client.debug("STDERR: " + data);
|
||||||
if (stream_proxy) {
|
if (stream_proxy) {
|
||||||
stream_proxy.stderr.emit("data", ...arguments);
|
stream_proxy.stderr.emit("data", ...arguments);
|
||||||
|
|
@ -86,7 +89,7 @@ class SshClient {
|
||||||
.connect(client.options.connection);
|
.connect(client.options.connection);
|
||||||
|
|
||||||
if (stream_proxy) {
|
if (stream_proxy) {
|
||||||
stream_proxy.on("kill", signal => {
|
stream_proxy.on("kill", (signal) => {
|
||||||
conn.end();
|
conn.end();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue