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

More file refactoring #40114

Merged
merged 3 commits into from
May 16, 2018
Merged

More file refactoring #40114

merged 3 commits into from
May 16, 2018

Conversation

abadger
Copy link
Contributor

@abadger abadger commented May 14, 2018

SUMMARY
  • Move creation of b_src and b_path from the src and path parameters into the state functions. It means repeated code but it is better to only pass a single value into the function instead of two that have the same meaning, just different formats.
  • Move rewriting of path when it is a directory into additional_parameter_handling because it's a parameter validation and conversion.
  • Only allow the src parameter to work with state=link and state=hard as documented. Emit a warning if src is set with any other state.
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lib/ansible/modules/files/file.py

ANSIBLE VERSION
devel

@ansibot ansibot added bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. docs This issue/PR relates to or includes documentation. 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. test This PR relates to tests. labels May 14, 2018
A good API should only require passing one version of a piece of data
around so do that for src
When the path is a directory we can rewrite the path to be a file inside
of the directory
@ansibot
Copy link
Contributor

ansibot commented May 14, 2018

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

lib/ansible/modules/files/file.py:181:9: E265 block comment should start with '# '

click here for bot help

@ansibot ansibot added ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels May 14, 2018
@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels May 14, 2018
@maxamillion
Copy link
Contributor

Rerunning CI since it's been a bit, but this looks good and I don't expect any issues. Once complete, I'll merge.

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label May 16, 2018
@abadger abadger merged commit 6227c2a into ansible:devel May 16, 2018
@abadger abadger deleted the file-refactor3 branch May 16, 2018 17:41
@abadger
Copy link
Contributor Author

abadger commented May 16, 2018

Merged for 2.6.0 release

@maxamillion
Copy link
Contributor

+1 ... sorry, I meant to follow up but then got distracted. :)

jacum pushed a commit to jacum/ansible that referenced this pull request Jun 26, 2018
* Set src in the state functions rather than the toplevel

A good API should only require passing one version of a piece of data
around so do that for src

* Move the rewriting of path into additional_parameter_handling

When the path is a directory we can rewrite the path to be a file inside
of the directory

* Emit a warning when src is used with a state where it should be ignored
ilicmilan pushed a commit to ilicmilan/ansible that referenced this pull request Nov 7, 2018
* Set src in the state functions rather than the toplevel

A good API should only require passing one version of a piece of data
around so do that for src

* Move the rewriting of path into additional_parameter_handling

When the path is a directory we can rewrite the path to be a file inside
of the directory

* Emit a warning when src is used with a state where it should be ignored
@ansible ansible locked and limited conversation to collaborators May 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. docs This issue/PR relates to or includes documentation. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team. test This PR relates to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants