diff --git a/src/lxc/commands_utils.py b/src/lxc/commands_utils.py index cf1d06d..2a3b48a 100644 --- a/src/lxc/commands_utils.py +++ b/src/lxc/commands_utils.py @@ -198,8 +198,10 @@ def copy_local_file_to_lxc(lxc: LXC, path: Path, destination: str): Path to the destination in the LXC """ - proxmox_utils.run_command_locally(command=f"scp -B {str(path)} {lxc.get_ssh_string()}:{destination}", - return_status_code=True) + command = proxmox_utils.run_command_locally(command=f"scp -B {str(path)} {lxc.get_ssh_string()}:{destination}", + return_status_code=True) + if command.returncode != 0: + raise Exception(f"Unable to copy file {str(path)} to LXC {lxc.get_id()} at {destination}, probably SSH key issue") def copy_local_folder_to_lxc(lxc: LXC, path: Path, destination: str): @@ -215,8 +217,10 @@ def copy_local_folder_to_lxc(lxc: LXC, path: Path, destination: str): Path to the destination in the LXC """ - proxmox_utils.run_command_locally(command=f"scp -B -r {str(path)} {lxc.get_ssh_string()}:{destination}", - return_status_code=True) + command = proxmox_utils.run_command_locally(command=f"scp -B -r {str(path)} {lxc.get_ssh_string()}:{destination}", + return_status_code=True) + if command.returncode != 0: + raise Exception(f"Unable to copy file {str(path)} to LXC {lxc.get_id()} at {destination}, probably SSH key issue") def run_docker_command(lxc: LXC, container: str, command: str):