mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
b4a1542670
when using "state: link", and particularly when using "force: yes". Symbolic link resolution can be expensive. In our case, the symbolic links are legacy links to automounts, and the "file" task was causing all of the legacy links to be traversed and mounted on every host every time the task executed, even when the links were correct and there was nothing to do. This change avoids the system calls that perform the symbolic link resolution by taking advantage of the short circuit behaviur of the boolean "and" operator. The code behaviour is unchanged except that it no longer performs unnecessary system calls. As it turns out, this change is not sufficient to fully solve the symbolic link resolution problem, as the "file" module still performs a stat() at the end of execution to provide the caller with information about the file. However, this change is very simple, it will eliminate unnecessary system calls in a number of use cases, and it gets the "file" module closer to the desired end result. |
||
---|---|---|
.. | ||
ansible |