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

Projects
None yet
4 participants
@Ch3LL
Contributor

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)

This comment has been minimized.

@rares-pop

rares-pop Jun 30, 2018

Contributor

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

This comment has been minimized.

@srkunze

srkunze Jul 4, 2018

Contributor

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)

This comment has been minimized.

@Ch3LL

Ch3LL Jul 9, 2018

Contributor

@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

This comment has been minimized.

Contributor

rares-pop commented Jul 9, 2018

Looks good to me!

@rallytime rallytime merged commit 16d3daa into saltstack:2017.7 Jul 10, 2018

9 of 16 checks passed

default Build finished.
Details
jenkins/PR/salt-pr-linode-cent7-py3 Pull Requests » Salt PR - Linode CentOS 7 - PY3 #6301 — FAILURE
Details
jenkins/PR/salt-pr-linode-ubuntu14-n Pull Requests » Salt PR - Linode Ubuntu14.04 #24229 — FAILURE
Details
jenkins/PR/salt-pr-rs-cent7-n Pull Requests » Salt PR - RS CentOS 7 #20354 — FAILURE
Details
jenkins/pr/py2-centos-7 The py2-centos-7 job has failed
Details
jenkins/pr/py2-ubuntu-1604 The py2-ubuntu-1604 job has failed
Details
jenkins/pr/py3-ubuntu-1604 The py3-ubuntu-1604 job has failed
Details
WIP ready for review
Details
continuous-integration/jenkins/pr-merge This commit looks good
Details
jenkins/PR/salt-pr-clone Pull Requests » Salt PR - Clone #26513 — SUCCESS
Details
jenkins/PR/salt-pr-docs-n Pull Requests » Salt PR - Docs #18547 — SUCCESS
Details
jenkins/PR/salt-pr-linode-ubuntu16-py3 Pull Requests » Salt PR - Linode Ubuntu16.04 - PY3 #11271 — SUCCESS
Details
jenkins/PR/salt-pr-lint-n Pull Requests » Salt PR - Code Lint #23183 — SUCCESS
Details
jenkins/pr/docs The docs job has passed
Details
jenkins/pr/lint The lint job has passed
Details
jenkins/pr/py3-centos-7 The py3-centos-7 job has passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment