I am using python 3 and fabric 2 library from a Windows Server 2019 to access Azure remote Linux server (3.10.0-1127.19.1.el7.x86_64, LANG=en_US.UTF-8).
Doing a remote copy from fstab, I get no return and specials characters are displayed at the start and the end of the command if I turn the echo on.
def _map_folder_remotely(connection,fstab_entry):
print("Mapping folder remotely...")
now = datetime.now().strftime("%Y%m%d%H%M%S%f")
command = f"sudo cp -v /etc/fstab /home/azureuser/fstab.{now}"
result = connection.run(command=command, hide=False, echo=True)
if not result.ok:
raise RuntimeError(f"Command {command} failed")
print(result.stdout)
I get on screen:
Mapping folder remotely...
sudo cp -v /etc/fstab /home/azureuser/fstab.20201126144809557390
‘/etc/fstab’ -> ‘/home/azureuser/fstab.20201126144809557390’
and the fstab file is not copied Any idea about the problem? What wrong?