Skip to content
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

mode: preserve can be misleading/misunderstood, deprecate it and offer mode: preserve_src and mode: preserve_dest #71503

Closed
wookietreiber opened this issue Aug 28, 2020 · 2 comments
Labels
affects_2.11 feature This issue/PR relates to a feature request. files Files category module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@wookietreiber
Copy link
Contributor

SUMMARY

IMHO, mode: preserve is misleading and can be misunderstood. That is because the name by itself does not clearly specify which mode is to be preserved, the source or the destination. In my case, my intuition led me to believe that the mode on the destination is preserved. It would be more explicit/clear if it were named mode: preserve_src.

I know that the documentation says that it preserves the source mode. The issue is more about the first impression of what the name preserve suggests and that this can be misleading without having read the documentation (which if we're all honest not everyone immediately does). Especially, with the recent addition to ansible-lint to issue a warning about missing mode:

Missing mode parameter can cause unexpected file permissions based on version of Ansible being used. Be explicit, or if you still want the default behavior you can use mode: preserve to avoid hitting this rule. See #71200

With that, one is tempted to use mode: preserve, possibly assuming that it would preserve the mode of the destination.

(Personally, I don't even get why someone would preserve the mode of the source. Especially when I'm changing a config file that is originally deployed with the distributions package manager, shouldn't I always want to preserve the destination mode?)

ISSUE TYPE
  • Feature Idea
COMPONENT NAME
  • template
  • copy
  • all other modules using mode argument
@ansibot
Copy link
Contributor

ansibot commented Aug 28, 2020

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.11 feature This issue/PR relates to a feature request. files Files category module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Aug 28, 2020
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Sep 1, 2020
@samdoran
Copy link
Contributor

samdoran commented Sep 4, 2020

The start of this confusion stems from a bad recommendation by the ansible-lint rule. It should not be suggesting mode: preserve since that only works in two modules. We are actually in favor of removing this rule altogether since it causes so much confusion and should no longer be necessary.

I know that the documentation says that it preserves the source mode. The issue is more about the first impression of what the name preserve suggests and that this can be misleading without having read the documentation (which if we're all honest not everyone immediately does).

I understand how the name could be interpreted different ways before reading the documentation for clarification. Changing the name to preserve_src would make sense to you, but may just as easily confuse others. I'm not saying your interpretation is wrong, but that it is just that: your interpretation.

The documentation does clarify the behavior. I understand most folks do not read documentation, but changing the name would not remove the need to read the documentation for further clarification on the exact behavior.

To discuss this further, please reach out on IRC or the mailing list:

   * IRC: #ansible-devel on irc.freenode.net  
   * mailing list: https://groups.google.com/forum/#!forum/ansible-devel

@samdoran samdoran closed this as completed Sep 4, 2020
@ansible ansible locked and limited conversation to collaborators Oct 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.11 feature This issue/PR relates to a feature request. files Files category module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

No branches or pull requests

4 participants