Replace SSH node with Execute Command node

- Removed SSH dependency (was failing with 'Not connected to server')
- Now uses Execute Command node to check file directly on host
- Updated Final Verification to parse executeCommand output
- Command checks for file and displays content or 'File not found'
This commit is contained in:
Git Admin 2025-11-30 08:50:56 +00:00
parent 04a47dc0ce
commit 7a2b4a222c
1 changed files with 4 additions and 13 deletions

View File

@ -193,26 +193,17 @@
}, },
{ {
"parameters": { "parameters": {
"authentication": "genericCredentialType", "command": "=ls -la /home/bam/workspace/hello.txt 2>&1 && echo '---FILE CONTENT---' && cat /home/bam/workspace/hello.txt 2>&1 || echo 'File not found'"
"genericAuthType": "sshKey",
"command": "ls -la /home/bam/workspace/hello.txt 2>&1 && cat /home/bam/workspace/hello.txt",
"cwd": "/home/bam"
}, },
"id": "verify-file", "id": "verify-file",
"name": "8. Verify File Created", "name": "8. Verify File Created",
"type": "n8n-nodes-base.ssh", "type": "n8n-nodes-base.executeCommand",
"typeVersion": 1, "typeVersion": 1,
"position": [2220, 420], "position": [2220, 420]
"credentials": {
"sshKey": {
"id": "1",
"name": "ai-dev-localhost"
}
}
}, },
{ {
"parameters": { "parameters": {
"jsCode": "// Parse SSH output to verify file\nconst sshOutput = $input.item.json.stdout || '';\nconst analysisData = $('7. Analyze Results').item.json;\n\n// Check if file exists and has content\nconst fileExists = sshOutput.includes('hello.txt');\nconst hasContent = sshOutput.includes('Hello from n8n');\n\nreturn {\n conversation_id: analysisData.conversation_id,\n status: analysisData.status,\n total_events: analysisData.total_events,\n file_verified: fileExists,\n content_correct: hasContent,\n file_output: sshOutput,\n overall_success: fileExists && hasContent,\n message: fileExists && hasContent ? \n '✅ SUCCESS: File created and verified!' : \n '❌ FAILED: File not found or incorrect content'\n};" "jsCode": "// Parse command output to verify file\nconst commandOutput = $input.item.json.stdout || $input.item.json.stderr || JSON.stringify($input.item.json);\nconst analysisData = $('7. Analyze Results').item.json;\n\n// Check if file exists and has content\nconst fileExists = commandOutput.includes('hello.txt') && !commandOutput.includes('File not found');\nconst hasContent = commandOutput.includes('Hello from n8n');\n\nreturn {\n conversation_id: analysisData.conversation_id,\n status: analysisData.status,\n total_events: analysisData.total_events,\n file_verified: fileExists,\n content_correct: hasContent,\n file_output: commandOutput,\n overall_success: fileExists && hasContent,\n message: fileExists && hasContent ? \n '✅ SUCCESS: File created and verified!' : \n '❌ FAILED: File not found or incorrect content'\n};"
}, },
"id": "final-verification", "id": "final-verification",
"name": "9. Final Verification", "name": "9. Final Verification",