Secrets & Global Site Configuration

This commit is contained in:
Quentin WEPHRE
2024-11-21 16:07:03 +01:00
parent 1a383c5302
commit 034507434d
7 changed files with 115 additions and 78 deletions

View File

@@ -4,6 +4,10 @@ from urllib3.exceptions import InsecureRequestWarning
import json
import scp
import paramiko
import os
from dotenv import load_dotenv
load_dotenv()
def scp_file(local_path, remote_path, hostname, username, password):
try:
@@ -78,13 +82,16 @@ def ssh_execute_command_with_password(hostname, username, password, command):
requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning)
default_user = str(os.getenv("DEFAULT_MOXA_SSH_USER"))
default_password = str(os.getenv("DEFAULT_MOXA_SSH_PASSWORD"))
local_file_path = "AIG-301_1.5.2-20240625_saft1_armhf.deb"
if local_file_path == "":
print("Provide upgrade file path before running the script!")
exit(12)
remote_file_path = "./."
username = "moxa"
password = "moxa"
username = default_user
password = default_password
if username == "" or password == "":
print("Provide credentials before running the script!")
exit(10)