-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
zfs_delegate_admin.py: def current_perms
: unable to parse unknown uid and gid
#5941
Comments
Files identified in the description: If these files are incorrect, please update the |
I think the zfs allow command is itself a bit problematic here, in that it unconditionally prints the user/group name instead of the uid/gid (unless getgpwuid/getgrgid failed, and the name isn't known) (see links below). For config management tools it'd be better to manage the permissions based on uids/gids, but since zfs allow doesn't have such an output flag, that doesn't seem possible in the context of ansible. Practically, your suggestion of removing the "(unknown:)" seems like it could work. A better solution would be if someone added a command line flag for zfs allow/unallow to always print numeric id's (or more generally machine-parsable output). https://github.com/openzfs/zfs/blob/6017fd9377b217481097dda1206132ec81fcc8ef/cmd/zfs/zfs_main.c#L5444-L5469 |
Summary
There are few paths to take and it isn't up to me to decide for everyone. Feedback is appreciated before I submit a pull request.
Problem
When setting allow permissions using
community.general.zfs_delegate_admin
for particular users/groups there will be circumstances when a user/group in the output ofzfs allow <dataset>
is not known to the host system.In that case the output of
zfs allow <pool/dataset>
looks similar to this:
Then when using
community.general.zfs_delegate_admin
the module fails for all delegated permissions just because it cannot parseuser (unknown: 1002) hold
.Ansible output
Replicate
Give a user zfs allow permissions and then delete that user.
useradd test
zfs allow -u test hold
userdel test
Without modifying
zfs_delegate_admin.py
the solution is to either:a) make a user/group with a uid/gid that matches the one above on the host system
b) Remove uid (in this case) from the allow list:
zfs unallow -u 1002 tank/test
I suggest that this module does something helpful to allow permissions to be set that can be set or provide a more helpful error message.
Solutions
There are few paths to take and it isn't up to me to decide for everyone. Feedback is appreciated before I submit a pull request.
Provide helpful error message:
It isn't this modules job to manage unknowns and should be considered an error. Tell the admin and fail.
Ignore unknowns
It isn't this modules job to manage unknown users or groups. Silently ignore them.
It might be nice to insert a warning instead of being silent. Let me know what function I should use to do this.
remove ' (unknown: ' + ')' from the user field
This will leave just the uid/gid number and will allow the parser to proceed normally. This is almost like ignoring but I'm uncertain as to what happens later in the code. It seems like one could then fully manage all permissions and if a boolean was created and set remove unmanaged perms, which would then possibly include the ones without valid users/groups.
Issue Type
Bug Report
Component Name
community.general.zfs_delegate_admin
Ansible Version
$ ansible --version
Community.general Version
community.general 6.3.0
Configuration
.
OS / Environment
.
Steps to Reproduce
.
Expected Results
.
Actual Results
.
Code of Conduct
The text was updated successfully, but these errors were encountered: