backward incompatible change in module find in ansible 2.3

27 views
Skip to first unread message

Renaud Michel

unread,
Jul 6, 2017, 1:11:24 PM7/6/17
to ansible...@googlegroups.com
Hello

Thought I should mention this somewhere, there has been an incompatible
change in the find module in ansible 2.3, which is not mentioned in the
changelog (or I didn't understand it).

Until ansible 2.2, the file_type option accepted two values, 'file' and
'directory'.
Due to the use of the os.stat method, symbolic links pointing to a file
would be included for file_type=='file' and those pointing to directories
for file_type=='directory'.

Now in ansible 2.3, two new values for file_type have been added, 'link'
and 'any'.
Now the module uses the os.lstat method which does not follow symbolic
links (otherwise it would not be possible to distinguish them).

So if you used the find module with ansible 2.2 (or older) with the
file_type=='file' to list symbolic links in a directory it will not work
anymore with ansible 2.3.

For my own use case, I have done the following to be compatible with both
ansible 2.2 and 2.3:

file_type: '{{"link" if ansible_version.full|version_compare("2.3.0",">=") else "file"}}'

I actually wanted only the symbolic links, to compare the to a list of
wanted links and remove the others, but if you want the old behaviour of
file_type=='file' you need to filter the result of any and it will be
harder to be compatible with both 2.2 and 2.3.


I suppose it is too late to report this as a bug, as ansible 2.3 has been
released for some time already, changing it to be compatible with previous
versions would break it for people who stated using it with ansible 2.3.

--
Renaud MICHEL
defimedia S.A.

Kai Stian Olstad

unread,
Jul 6, 2017, 2:27:28 PM7/6/17
to ansible...@googlegroups.com
On 06. juli 2017 13:33, Renaud Michel wrote:
> I suppose it is too late to report this as a bug, as ansible 2.3 has been
> released for some time already, changing it to be compatible with previous
> versions would break it for people who stated using it with ansible 2.3.

It seams that the find module become stable in 2.3 so i guess this is OK.

The fist commit stableinterface appeared
$ git log -S stableinterface --source find.py
commit 73191045527834fbabc40cf47a2173d5933ae480 HEAD
Author: Toshio Kuratomi <a.ba...@gmail.com>
Date: Tue Dec 6 02:35:05 2016 -0800

Refreshed metadata for core modules

Tags containing that commit
$ git tag --contains 73191045527834fbabc40cf47a2173d5933ae480
v2.3.0.0-0.1.rc1
v2.3.0.0-0.2.rc2
v2.3.0.0-0.3.rc3
v2.3.0.0-0.4.rc4
v2.3.0.0-0.5.rc5
v2.3.0.0-0.6.rc6
v2.3.0.0-1
v2.3.1.0-0.1.rc1
v2.3.1.0-0.2.rc2
v2.3.1.0-1
v2.3.2.0-0.1.rc1

--
Kai Stian Olstad

Renaud Michel

unread,
Jul 10, 2017, 11:23:00 AM7/10/17
to ansible...@googlegroups.com
on 2017-07-06 at 20:27, Kai Stian Olstad wrote:
> On 06. juli 2017 13:33, Renaud Michel wrote:
> > I suppose it is too late to report this as a bug, as ansible 2.3 has been
> > released for some time already, changing it to be compatible with previous
> > versions would break it for people who stated using it with ansible 2.3.
>
> It seams that the find module become stable in 2.3 so i guess this is OK.

Oh, sorry I missed that.
So that's why it wasn't mentioned in the changelog.
Reply all
Reply to author
Forward
0 new messages