minor targetCli fix to work-around Ubuntu 18:04 bug

Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
Travis Glenn Hansen 2021-11-29 00:56:19 -07:00
parent d9bf3d7d2e
commit 3ab4023678
2 changed files with 27 additions and 10 deletions

View File

@ -353,7 +353,21 @@ delete ${iscsiName}
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(
"TargetCLI response: " + JSON.stringify(response)
);

View File

@ -38,7 +38,6 @@ class SshClient {
};
}
conn
.on("error", function (err) {
client.debug("Client :: error");
@ -46,6 +45,10 @@ class SshClient {
})
.on("ready", function () {
client.debug("Client :: ready");
//options.pty = true;
//options.env = {
// TERM: "",
//};
conn.exec(command, options, function (err, stream) {
if (err) reject(err);
let stderr;
@ -86,7 +89,7 @@ class SshClient {
.connect(client.options.connection);
if (stream_proxy) {
stream_proxy.on("kill", signal => {
stream_proxy.on("kill", (signal) => {
conn.end();
});
}