diff --git a/src/lxc/__init__.py b/src/lxc/__init__.py index dd217b0..4c99427 100644 --- a/src/lxc/__init__.py +++ b/src/lxc/__init__.py @@ -170,7 +170,7 @@ class LXC: if self.is_running(): if self.has_program("ip"): return self.run_command( - command="ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print \$2}' | cut -f1 -d'/'") + command="ip addr | grep \'state UP\' -A2 | tail -n1 | awk \'{{print $2}}\' | cut -f1 -d\'/\'") elif self.has_program("ifconfig"): return self.run_command(command="ifconfig eth0 | awk '/inet addr/{print substr($2,6)}'") diff --git a/src/lxc/commands_utils.py b/src/lxc/commands_utils.py index 7c5e3bb..9286cbb 100644 --- a/src/lxc/commands_utils.py +++ b/src/lxc/commands_utils.py @@ -87,7 +87,7 @@ def copy_local_file_to_lxc(lxc, path, destination): Path to the destination in the LXC """ - proxmox_utils.run_command_locally(f"scp {path} {lxc.get_ssh_string()}:{destination}") + proxmox_utils.run_command_locally(f"scp {get_path(lxc, path)} {lxc.get_ssh_string()}:{destination}") def copy_local_folder_to_lxc(lxc, path, destination): @@ -103,7 +103,7 @@ def copy_local_folder_to_lxc(lxc, path, destination): Path to the destination in the LXC """ - proxmox_utils.run_command_locally(f"scp -r {path} {lxc.get_ssh_string()}:{destination}") + proxmox_utils.run_command_locally(f"scp -r {get_path(lxc, path)} {lxc.get_ssh_string()}:{destination}") def run_docker_command(lxc, container, command): diff --git a/src/utils/proxmox_utils.py b/src/utils/proxmox_utils.py index da6d869..981925c 100644 --- a/src/utils/proxmox_utils.py +++ b/src/utils/proxmox_utils.py @@ -81,7 +81,7 @@ def run_command_on_pve(command, warn_exit_status=False, only_code=False, local=F # Check if PVE is local or remote if config['pve']['local'] or local: # Run command and return output (not as bytes) - logging.debug(f"Running command on PVE (locally): {command}") + logging.debug(f"Running command on PVE/Machine running this script (locally): {command}") command = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8")