acep-uaf / camio-meter-streams

0 stars 0 forks source link

Enhance LFTP Connection Handling for test connection #139

Open nicolemah99 opened 2 weeks ago

nicolemah99 commented 2 weeks ago

Issue Summary: Improve the robustness and clarity of the FTP connection handling in test_meter_connection.sh to address issues with incorrect or unstable IP addresses.

Proposed Changes:

  1. Validate IP Address Format:
    • Ensure the provided meter_ip is in a valid IPv4 format before attempting a connection.
      1. Implement Retry Mechanism:
    • Add a retry mechanism to attempt connecting to the meter up to 3 times, with a 5-second delay between attempts.
      1. Set Connection Timeout:
    • Use a 10-second timeout for each lftp command to prevent hanging indefinitely on connection attempts.
      1. Detailed Logging:
    • Enhance logging to provide detailed output for each connection attempt, including lftp errors for diagnostic purposes.
      1. Graceful Failure Handling:
    • If all connection attempts fail, log a detailed error and exit using the fail function with EXIT_LFTP_FAIL code.

Benefits:

Tasks: