0

This might not be a valid question. I was going through source of copy module at github. While I could understand what and how it is doing one thing I am not able to get. I see following two lines

if not os.path.exists(src)

and

if os.path.exists(dest):

While I get that these lines are checking the presence of source and dest directories, how does python knows where to look these on as they are on different machines (the ansible server and host). How does python differentiates them and looks for them on their repective machines?

Can someone please help?

4

1 回答 1

0

我认为这个复制模块(库/文件/复制)不起作用。

通常,当我们使用这样的命令时,

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

ansible 将优先使用这个 runner 模块(lib/ansible/runner/action_plugins/copy.py)

我尝试运行相同的命令,隐藏 runner 模块。然后,(ansible/library/file/copy)模块被执行。然而,这并没有完成预期的工作。有几个问题,这段代码是原因之一。

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

两者都检查远程主机上的文件。

于 2013-07-18T15:06:21.907 回答