Skip to content

Support emptying groups when no members in list and auth_membership is true - #24

Open
legooolas wants to merge 3 commits into
simp:masterfrom
legooolas:master
Open

Support emptying groups when no members in list and auth_membership is true#24
legooolas wants to merge 3 commits into
simp:masterfrom
legooolas:master

Conversation

@legooolas

Copy link
Copy Markdown

This just allows passing through of the empty to_be_added list to the gpasswd -M arguments list, which causes the group to indeed be emptied successfully.

(Also moved the "Ignoring unknown user" debug print to the rescue block in members_insync?, as this is where the control jumps to on getpwuid or getpwnam throwing an exception when the user isn't found. No logic change, just that the message was printed when users were found rather than not 👍 )

@legooolas

Copy link
Copy Markdown
Author

I need to test this more on different platforms, but it's working as a first-pass change on my Ubuntu 22.04 test box :)

@legooolas

Copy link
Copy Markdown
Author

Fixes #20

@legooolas

Copy link
Copy Markdown
Author

Tested on Ubuntu 18.04/20.04/22.04, CentOS 6, CentOS 7, Rocky 8 and all working OK, so presumably will work on pretty much everything this module already worked on :)

@op-ct op-ct left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, @legooolas!

The code lgtm 👍, but be aware that it might take a while before someone is free to add unit tests for this prior to a release—however, we'd happily accept any tests if they were contributed!

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.

2 participants