mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Add continueOnFail support to SSH Node
This commit is contained in:
parent
a9184e38f8
commit
cd8f4247e6
|
@ -328,7 +328,7 @@ export class Ssh implements INodeType {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < items.length; i++) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
|
try {
|
||||||
if (resource === 'command') {
|
if (resource === 'command') {
|
||||||
|
|
||||||
if (operation === 'execute') {
|
if (operation === 'execute') {
|
||||||
|
@ -346,7 +346,7 @@ export class Ssh implements INodeType {
|
||||||
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i) as string;
|
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i) as string;
|
||||||
const parameterPath = this.getNodeParameter('path', i) as string;
|
const parameterPath = this.getNodeParameter('path', i) as string;
|
||||||
|
|
||||||
const { path } = await file({mode: 0x0777, prefix: 'prefix-'});
|
const { path } = await file({ mode: 0x0777, prefix: 'prefix-' });
|
||||||
temporaryFiles.push(path);
|
temporaryFiles.push(path);
|
||||||
|
|
||||||
await ssh.getFile(path, parameterPath);
|
await ssh.getFile(path, parameterPath);
|
||||||
|
@ -393,11 +393,28 @@ export class Ssh implements INodeType {
|
||||||
temporaryFiles.push(path);
|
temporaryFiles.push(path);
|
||||||
await writeFile(path, Buffer.from(binaryData.data, BINARY_ENCODING));
|
await writeFile(path, Buffer.from(binaryData.data, BINARY_ENCODING));
|
||||||
|
|
||||||
await ssh.putFile(path, `${parameterPath}${(parameterPath.charAt(parameterPath.length -1) === '/') ? '' : '/'}${fileName || binaryData.fileName}`);
|
await ssh.putFile(path, `${parameterPath}${(parameterPath.charAt(parameterPath.length - 1) === '/') ? '' : '/'}${fileName || binaryData.fileName}`);
|
||||||
|
|
||||||
returnData.push({ success: true });
|
returnData.push({ success: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log('error', error);
|
||||||
|
if (this.continueOnFail()) {
|
||||||
|
console.log('k1');
|
||||||
|
if (resource === 'file' && operation === 'download') {
|
||||||
|
items[i] = {
|
||||||
|
json: {
|
||||||
|
error: error.message,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
returnData.push({ error: error.message });
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
ssh.dispose();
|
ssh.dispose();
|
||||||
|
|
Loading…
Reference in a new issue