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

Fix dir perms #784

Merged
merged 4 commits into from Apr 4, 2019
Merged

Fix dir perms #784

merged 4 commits into from Apr 4, 2019

Conversation

@ajeddeloh
Copy link
Contributor

ajeddeloh commented Apr 2, 2019

No description provided.

@ajeddeloh ajeddeloh force-pushed the ajeddeloh:fix-dir-perms branch from e020d26 to 7ebb498 Apr 2, 2019
@ajeddeloh ajeddeloh marked this pull request as ready for review Apr 3, 2019
@ajeddeloh ajeddeloh mentioned this pull request Apr 3, 2019
Copy link
Member

jlebon left a comment

Just one note otherwise LGTM!

if err != nil {
return err
}
return os.Chown(f.Path, uid, gid)
return os.Chown(node.Path, uid, gid)

This comment has been minimized.

Copy link
@jlebon

jlebon Apr 4, 2019

Member

Minor: how about just catching and prefixing the error with the path here? Right now we're doing it in the dirEntry path on the calling side, but not in the fileEntry path.

This comment has been minimized.

Copy link
@ajeddeloh

ajeddeloh Apr 4, 2019

Author Contributor

💯 This is something that's rampant in the Ignition codebase.

@ajeddeloh ajeddeloh force-pushed the ajeddeloh:fix-dir-perms branch from 59de606 to af50d1f Apr 4, 2019
@ajeddeloh

This comment has been minimized.

Copy link
Contributor Author

ajeddeloh commented Apr 4, 2019

Improved error handling and fixed the gofmt issue.

}

if err := u.SetPermissions(d.Mode, d.Node); err != nil {
return fmt.Errorf("error setting permissions of %s: %v", d.Path, err)

This comment has been minimized.

Copy link
@jlebon

jlebon Apr 4, 2019

Member

We can drop this now and just return u.SetPermissions(...) like in the fileEntry case now, right?

This comment has been minimized.

Copy link
@ajeddeloh

ajeddeloh Apr 4, 2019

Author Contributor

Fixed as we talked about in IRC

ajeddeloh added 4 commits Apr 2, 2019
If overwrite is false and the config specifies a directory should exist,
don't fail if a directory already exists, just change the permissions.
If the user wants to ensure the directory is empty, use overwrite=true.
Ignition should not bring up an incorrect system. If there is no
restorecon command we should fail hard. This also lets us drop the
FileExists() function.
Clarify what Ignition will do with various combinations of files
existing, overwrite and (for files) source being unspecified.
Add test that if overwrite=false and a directory already exists, we just
fix the permissions and don't fail.
@ajeddeloh ajeddeloh force-pushed the ajeddeloh:fix-dir-perms branch from af50d1f to 8dcfe38 Apr 4, 2019
@jlebon
jlebon approved these changes Apr 4, 2019
@jlebon

This comment has been minimized.

Copy link
Member

jlebon commented Apr 4, 2019

LGTM!

@ajeddeloh ajeddeloh merged commit f7c178b into coreos:master Apr 4, 2019
2 checks passed
2 checks passed
Black Box Tests Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.