Skip to content

Commit dff7073

Browse files
committed
Added SSH debug output option
Signed-off-by: Seb Julliand <[email protected]>
1 parent ec791e3 commit dff7073

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

src/api/IBMi.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ export default class IBMi {
273273
}
274274
await this.client.connect({
275275
...connectionObject,
276-
privateKeyPath: connectionObject.privateKeyPath ? Tools.resolvePath(connectionObject.privateKeyPath) : undefined
276+
privateKeyPath: connectionObject.privateKeyPath ? Tools.resolvePath(connectionObject.privateKeyPath) : undefined,
277+
debug: connectionObject.sshDebug ? (message: string) => this.appendOutput(`\n[SSH debug] ${message}`) : undefined
277278
} as node_ssh.Config);
278279

279280
let wasCancelled = false;

src/api/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export interface ConnectionData {
6565
privateKeyPath?: string;
6666
keepaliveInterval?: number;
6767
readyTimeout?: number;
68+
sshDebug?: boolean;
6869
}
6970

7071
export interface Server {

src/webviews/login/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ export class Login {
3636
.addCheckbox(`savePassword`, l10n.t(`Save Password`))
3737
.addFile(`privateKeyPath`, l10n.t(`Private Key`), l10n.t(`OpenSSH, RFC4716 and PPK formats are supported.`))
3838
.addHorizontalRule()
39-
.addInput(`readyTimeout`, l10n.t(`Connection Timeout (in milliseconds)`), l10n.t(`How long to wait for the SSH handshake to complete.`), { inputType: "number", min: 1, default: "20000" });
40-
39+
.addInput(`readyTimeout`, l10n.t(`Connection Timeout (in milliseconds)`), l10n.t(`How long to wait for the SSH handshake to complete.`), { inputType: "number", min: 1, default: "20000" })
40+
.addCheckbox(`sshDebug`, l10n.t(`Turn on SSH debug output`), l10n.t(`Enable this to output debug traces in the Code for i and help diagnose SSH connection issues.`));
4141
const tempTab = new Section()
4242
.addInput(`tempLibrary`, `Temporary library`, `Temporary library. Cannot be QTEMP.`, { default: `ILEDITOR`, minlength: 1, maxlength: 10 })
4343
.addInput(`tempDir`, `Temporary IFS directory`, `Directory that will be used to write temporary files to. User must be authorized to create new files in this directory.`, { default: '/tmp', minlength: 1 });

src/webviews/settings/index.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class SettingsUI {
4040
const passwordAuthorisedExtensions = instance.getStorage()?.getAuthorisedExtensions() || [];
4141

4242
let config: ConnectionConfig;
43-
let serverConfig: RemoteConfigFile|undefined;
43+
let serverConfig: RemoteConfigFile | undefined;
4444

4545
if (connectionSettings && server) {
4646
config = await IBMi.connectionManager.load(server.name);
@@ -68,7 +68,7 @@ export class SettingsUI {
6868
if (serverConfig && serverConfig.codefori) {
6969
for (const field of currentSection.fields) {
7070
if (!field.id) continue;
71-
71+
7272
if (serverConfig.codefori[field.id] !== undefined) {
7373
field.readonly = true;
7474
}
@@ -204,7 +204,7 @@ export class SettingsUI {
204204
.set("Debug port", config.debugPort);
205205

206206
debugServiceConfig.set("SEP debug port", config.debugSepPort)
207-
207+
208208
debuggerTab.addParagraph(`<ul>${Array.from(debugServiceConfig.entries()).map(([label, value]) => `<li><code>${label}</code>: ${value}</li>`).join("")}</ul>`);
209209

210210
debuggerTab.addCheckbox(`debugUpdateProductionFiles`, `Update production files`, `Determines whether the job being debugged can update objects in production (<code>*PROD</code>) libraries.`, config.debugUpdateProductionFiles)
@@ -395,7 +395,8 @@ export class SettingsUI {
395395
.addPassword(`password`, `${vscode.l10n.t(`Password`)}${storedPassword ? ` (${vscode.l10n.t(`stored`)})` : ``}`, vscode.l10n.t("Only provide a password if you want to update an existing one or set a new one."))
396396
.addFile(`privateKeyPath`, `${vscode.l10n.t(`Private Key`)}${privateKeyPath ? ` (${vscode.l10n.t(`Private Key`)}: ${privateKeyPath})` : ``}`, privateKeyWarning + vscode.l10n.t("Only provide a private key if you want to update from the existing one or set one.") + '<br />' + vscode.l10n.t("OpenSSH, RFC4716 and PPK formats are supported."))
397397
.addHorizontalRule()
398-
.addInput(`readyTimeout`, vscode.l10n.t(`Connection Timeout (in milliseconds)`), vscode.l10n.t(`How long to wait for the SSH handshake to complete.`), { inputType: "number", min: 1, default: stored.readyTimeout ? String(stored.readyTimeout) : "20000" })
398+
.addInput(`readyTimeout`, vscode.l10n.t(`Connection Timeout (in milliseconds)`), vscode.l10n.t(`How long to wait for the SSH handshake to complete.`), { inputType: "number", min: 1, default: stored.readyTimeout ? String(stored.readyTimeout) : "20000" })
399+
.addCheckbox(`sshDebug`, vscode.l10n.t(`Turn on SSH debug output`), vscode.l10n.t(`Enable this to output debug traces in the Code for i and help diagnose SSH connection issues.`), stored.sshDebug)
399400
.addButtons(
400401
{ id: `submitButton`, label: vscode.l10n.t(`Save`), requiresValidation: true },
401402
{ id: `removeAuth`, label: vscode.l10n.t(`Remove auth methods`) }
@@ -477,9 +478,9 @@ function installComponentsQuickPick(connection: IBMi) {
477478
placeHolder: `Select component${withS} to install`
478479
}).then(async result => {
479480
if (result) {
480-
window.withProgress({title: `Component${withS}`, location: vscode.ProgressLocation.Notification}, async (progress) => {
481+
window.withProgress({ title: `Component${withS}`, location: vscode.ProgressLocation.Notification }, async (progress) => {
481482
for (const item of result) {
482-
progress.report({message: `Installing ${item.label}...`});
483+
progress.report({ message: `Installing ${item.label}...` });
483484
try {
484485
await connection.getComponentManager().installComponent(item.id);
485486
} catch (e) {

0 commit comments

Comments
 (0)