Navigation Menu

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

Add user and group to makedirs cmd in file.copy #48375

Merged
merged 2 commits into from Jul 10, 2018

Conversation

Ch3LL
Copy link
Contributor

@Ch3LL Ch3LL commented Jun 29, 2018

What does this PR do?

Ensures we are setting user and group when creating the directories before copying. @terminalmage one thing I was not certain about was the case when a user would use preserve: True. Should I be grabbing the user perms of the original file and then create the directories with those permissions? Or would it be expected that the user would not user preserve with make_dirs?

What issues does this PR fix or reference?

#35595

Previous Behavior

Created directories with root user/group owners, not the ones specified in the state.

New Behavior

Creates directories with correct user/group owners

Tests written?

Yes

Commits signed with GPG?

Yes

@@ -5663,7 +5663,7 @@ def copy(
if not os.path.isdir(dname):
if makedirs:
try:
_makedirs(name=name)
_makedirs(name=name, user=user, group=group)
Copy link
Contributor

Choose a reason for hiding this comment

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

what about 'mode'? should that be added too?

Copy link
Contributor

Choose a reason for hiding this comment

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

Additional question: salt/states/file.py also contains a lot more of those _makedirs(name=name) calls. Shouldn't those also be called with almost all parameters?

(provided that _makedirs does the right thing)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@srkunze i looked at the other _makedirs calls and those functions do not include the user/group/mode arguments to the function so I think for this PR just adding it for file.copy will be fine and if we want to add the user/group arguments to the other functions that can be handled in another PR in develop.

also nice catch @rares-pop i'll work on adding that

@rares-pop
Copy link
Contributor

Looks good to me!

@rallytime rallytime merged commit 16d3daa into saltstack:2017.7 Jul 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants