做一次python3 fabric模块的分发文件测试,遇到的问题。
脚本方法:
def put_task():
put('/home/startUp.sh', '/mnt/startUp.sh')
执行:$ fab put_task
报错:
[192.168.1.175] Executing task 'put_task'
[192.168.1.175] put: /home/startUp.sh -> /mnt/startUp.sh
Fatal error: put() encountered an exception while uploading '/home/vortex/startUp.sh'
Underlying exception:
size mismatch in put! 0 != 8021
Aborting.
Disconnecting from 192.168.1.175... done.
根据提示:
查看源文件大小:
$ ll /home/
total 72
drwxr-xr-x 7 root root 4096 Sep 29 16:53 ./
drwxr-xr-x 3 root root 4096 Sep 14 14:49 ../
-rw-r--r-- 1 root root 8021 Sep 29 12:07 startUp.sh 《===可以看到8021
查看目的主机文件大小(主机1.175):
# ll -h
total 3.0M
-rw-r--r-- 1 root root 0 Sep 29 16:49 startUp.sh