Skip to content

Commit

Permalink
Merge pull request #36 from RIKEN-RCCS/fixSSH
Browse files Browse the repository at this point in the history
Fix ssh
  • Loading branch information
so5 authored Feb 13, 2024
2 parents 3ad2d3e + 6efeb47 commit 25f492e
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 16 deletions.
2 changes: 1 addition & 1 deletion client/src/components/Remotehost.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default {
{ title: "name", key: "name" },
{ title: "connection test", key: "connectionTest" },
{ title: "hostname", key: "host" },
{ title: "usrename", key: "username" },
{ title: "user", key: "user" },
{ title: "port", key: "port" },
{ title: "private key", key: "keyFile" },
{ title: "action", key: "action", sortable: false },
Expand Down
1 change: 1 addition & 0 deletions client/src/components/common/passwordDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<template>
<v-dialog
v-model="openDialog"
persistent
:max-width="maxWidth"
>
<v-card
Expand Down
1 change: 1 addition & 0 deletions client/src/components/common/removeConfirmDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<v-dialog
v-model="openDialog"
:max-width="maxWidth"
persistent
>
<v-card
:title=title
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/remotehost/addNewHostDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<v-dialog
v-model="openDialog"
:max-width="maxWidth"
:persistent="true"
persistent
>
<v-card>
<v-card-title>
Expand Down Expand Up @@ -55,7 +55,7 @@
</v-col>
<v-col cols="6">
<v-text-field
v-model="host.username"
v-model="host.user"
label="User ID"
:rules="[required]"
placeholder="required"
Expand Down Expand Up @@ -264,7 +264,7 @@ export default {
|| this.required(this.host.name) !== true
|| this.required(this.host.host) !== true
|| this.validPortNumber(this.host.port) !== true
|| this.required(this.host.username) !== true
|| this.required(this.host.user) !== true
},
openDialog: {
get () {
Expand Down
7 changes: 5 additions & 2 deletions server/app/core/sshManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,11 @@ async function createSsh(projectRootDir, remoteHostName, hostinfo, clientID, isS
if (process.env.WHEEL_VERBOSE_SSH) {
hostinfo.sshOpt = ["-vvv"];
}
if(hostinfo.username && !hostinfo.user){
hostinfo.user = hostinfo.username
if(hostinfo.username){
if( !hostinfo.user){
hostinfo.user = hostinfo.username
}
delete hostinfo.username
}

const ssh = new SshClientWrapper(hostinfo);
Expand Down
2 changes: 1 addition & 1 deletion server/app/db/version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version": "2024-0211-171905" }
{"version": "2024-0213-173244" }
23 changes: 20 additions & 3 deletions server/app/handlers/remoteHost.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const schema = {
id: { type: "string" },
name: { type: "string" },
host: { type: "string" },
username: { type: "string" },
user: { type: "string" },
port: {
type: "number",
minimum: 0,
Expand All @@ -49,9 +49,9 @@ const schema = {
readyTimeout: { type: "number", minimum: 0 }
},
additionalProperties: false,
required: ["name", "host", "username"]
required: ["name", "host", "user"]
};
//username is not required parameter for ssh-client-wrapper
//user is not required parameter for ssh-client-wrapper
//but its default value is owner of WHEEL process on localhost
//so, it is practically required value

Expand Down Expand Up @@ -86,6 +86,15 @@ async function onCopyHost(socket, id, cb) {
}

async function onGetHostList(cb) {
const hostList = remoteHost.getAll()
hostList.forEach((hostInfo)=>{
if(hostInfo.username){
if( !hostInfo.user){
hostInfo.user = hostInfo.username
}
delete hostInfo.username
}
});
cb(remoteHost.getAll());
}

Expand All @@ -95,6 +104,14 @@ async function onUpdateHost(socket, updatedHost, cb) {
delete updatedHost[prop]
}
});

if(updatedHost.username){
if( !updatedHost.user){
updatedHost.user = updatedHost.username
}
delete updatedHost.username
}

validate(updatedHost);

if(Array.isArray(validate.errors)){
Expand Down
2 changes: 1 addition & 1 deletion server/app/handlers/tryToConnect.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async function tryToConnect(clientID, hostInfo, cb) {
hostInfo.sshOpt = ["-vvv"];
}
const ssh = new SshClientWrapper(hostInfo);
logger.debug(`try to connect ${hostInfo.username}@${hostInfo.host}:${hostInfo.port}`);
logger.debug(`try to connect ${hostInfo.user}@${hostInfo.host}:${hostInfo.port}`);

try {
await ssh.canConnect(120);
Expand Down
8 changes: 4 additions & 4 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"simple-batch-system": "^1.15.0",
"socket.io": "^4.6.0",
"socketio-file-upload": "^0.7.3",
"ssh-client-wrapper": "^2.2.3",
"ssh-client-wrapper": "^2.2.7",
"stat-mode": "^1.0.0",
"through2": "^4.0.2",
"uuid": "^9.0.0",
Expand Down

0 comments on commit 25f492e

Please sign in to comment.