fixed get_ipv4 awk formatting, fix get path for folder and file copy
This commit is contained in:
parent
9ec4eb2382
commit
c7d0275915
@ -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)}'")
|
||||
|
||||
|
@ -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):
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user