-
Notifications
You must be signed in to change notification settings - Fork 23.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
copy: do not chmod if mode in not set #40220
Comments
Files identified in the description: If these files are inaccurate, please update the |
And #7372 is about chown(). This about chmod(). And patch there compares uid/gid to figure out wether to do chown() or not. But I want to be able to have an option to skip chown/chmod completely. So one can use filesystems which do not support those operations. |
This changes works for me. Not sure though if I access mode parameter correctly. |
Files identified in the description: If these files are incorrect, please update the |
This is expected behavior, |
So what? Should we throw away any users with non-posix filesystems then? I suggest that ansible has some mode for "copy" when it can be usable for non-posix systems too. Isn't it a reasonable feature? |
It is reasonable to a point, for example, have win_copy for windows, for other systems a specific module might be needed per OS, due to the proprietary nature of most of these it is unlikely that the core team will develop them or accept them in core, as collections would be a more appropriate home for them. |
Separate module is not a good option, because it will be needed to have a separate module for template too and may be some others, if they depend on copy. Actually it there is not much to do in the copy module itself, but it is something done in supporting functions, that are not flexible enough for such cases. Even if it were a separate module, it would be good, I suppose, to use the same codebase for it. |
we HAVE a win_copy module for these reasons, its not just chmod, you would have to disable stating, setfacl, chown, chgrp, selinux context ... and that is just off top of my head. |
I have doubt it works for me, because the documentation says:
I have Linux and ssh, do not even know what that WinRM is. :) But I'll try it. PS. I had problems with the module failing only because of chmod/chown/chgrp - they causes exception. Even if it tries to do something other - it still works without failing. |
i'm NOT telling you to use win_copy, i was using it as an example that for non posix systems we would need a dedicated module. |
OK, misunderstood it. :) |
ISSUE TYPE
COMPONENT NAME
copy module
ANSIBLE VERSION
CONFIGURATION
N/A
OS / ENVIRONMENT
from Ubuntu Linux
manage Arista switch with Fedora-based OS
or
manage another Ubuntu Linux
SUMMARY
When using "copy" module with destination on a file system not supporting chmod(), I'm getting an exception.
vfat not always returns an error on chmod() call. If the filesystem is owned by the same user, it does not actually change permissions, but returns no error. If another user is able to write to this filesystem - for him chmod returns an error.
chmod() should not be called when mode is not specified or errors from it should be ignored.
STEPS TO REPRODUCE
Example of operations on vfat mount from user not owning the fs, but with write access:
User can create file, but chmod returns an error. The owner (nobody) have no error on chmod;
EXPECTED RESULTS
No errors, file copied to managed host.
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: