2013-07-04 27 views
0

這可能不是一個有效的問題。我正在通過github通過copy module。 雖然我能理解我做了一件事情,但我無法得到。我看到下面兩行複製模塊如何理解在哪裏檢查src和dest目錄?

if not os.path.exists(src) 

if os.path.exists(dest): 

雖然我得到這些線檢查源和目標目錄的存在,Python是怎樣知道去哪裏找這些上,因爲它們是不同的機器(服務器和主機)。 python如何區分它們並在它們的相應機器上查找它們?

有人可以幫忙嗎?

回答

0

我認爲這個副本模塊(liblary/file/copy)不起作用。

通常情況下,當我們用這樣的命令,

ansible webservers -m copy -a "src=/tmp/foo.conf dest=/tmp/bar.conf" 

ansible將使用this runnner module(lib/ansible/runner/action_plugins/copy.py)優先。

我試着運行相同的命令,隱藏跑步者模塊。然後,執行(ansible/liblary/file/copy)模塊。但是,這並沒有做到預期的工作。有幾個問題,這個代碼是一個原因。

if not os.path.exists(src) 
if os.path.exists(dest): 

兩者都檢查遠程主機上的文件。