Skip to content

Fix max_depth not respected in file.directory state #68254

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

Closed

Conversation

Faelysse
Copy link

@Faelysse Faelysse commented Aug 12, 2025

What does this PR do?

This fixes the max_depth parameter being ignored when using file.directory state and recursion

What issues does this PR fix or reference?

Fixes #55306

Previous Behavior

Instead of intended behaviour (only modifying sub-directories and/or sub-files to a certain depth level, it modified every single file in the given path recursively.

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Yes

@Faelysse Faelysse requested a review from a team as a code owner August 12, 2025 12:23
Copy link

welcome bot commented Aug 12, 2025

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at saltproject.pdl@broadcom.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!

Copy link
Contributor

@twangboy twangboy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are we testing that max_depth is being honored?
Additionally, if this bug exists in 3006.x, the PR should be created against the 3006.x branch. Master is for new features.

@twangboy twangboy added the test:full Run the full test suite label Aug 12, 2025
@twangboy twangboy added this to the Sulfur v3006.15 milestone Aug 12, 2025
@twangboy twangboy changed the title Fix max_depth not respected n file.directory state Fix max_depth not respected in file.directory state Aug 12, 2025
@Faelysse
Copy link
Author

Faelysse commented Aug 12, 2025

Where are we testing that max_depth is being honored?

I modified the test in tests/pytests/functional/states/file/test_directory.py::test_directory_max_depth to also modify and check files. If you cherry-pick only this change to tests into mainline, the test will fail. Previously, we only checked if folders are modified and this behaviour is correct, only files were handled incorrectly.

Additionally, if this bug exists in 3006.x, the PR should be created against the 3006.x branch. Master is for new features.

This bug exists in Salt ever likely (can't verify) since 6d52aeb, and it was reported in the linked issue to be at earliest in 2019.2.0 . Should I re-target to 3006.x or something even older? Or, should I create a new PR?

@twangboy
Copy link
Contributor

3006.x is the earliest supported branch. That's where it should go.

@twangboy twangboy closed this Aug 12, 2025
@twangboy twangboy reopened this Aug 12, 2025
@Faelysse
Copy link
Author

Created #68256 to merge into 3006.x . I'm not used to GitHub, so I'm sorry if I should have done it other way.

@twangboy
Copy link
Contributor

OK, we'll close this one in favor of #68256

@twangboy twangboy closed this Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test:full Run the full test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

file.directory recursive permissions not respecting max_depth for files
2 participants