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

group resource fails when provider => 'groupadd' not explicitly set #9350

Open
mojibake-umd opened this issue May 16, 2024 · 1 comment
Open
Labels
bug Something isn't working triaged Jira issue has been created for this

Comments

@mojibake-umd
Copy link

Describe the Bug

When a group resource which has not been created(new), and is add/managing member to the group on creation "fails" to purge the group if provider is not explicitly set to 'groupadd'.
It seems that "groupmod" is selected for the localmodify command when defining the purge_members and results in error as groupmod does not have a "-m" option.

Expected Behavior

A new group resource should be created without need to explicitly set provider.

Steps to Reproduce

Steps to reproduce the behavior:

Make sure this is a new group that does not exist on system.
Behavior will not appear if group exists.

$members = [ 'larry', 'moe', 'curly' ]

  group { 'sftponly':
    ensure          => 'present',
    auth_membership => true,
    members         => $members,
    forcelocal      => true,
  } 

results in

Debug: Executing: '/usr/sbin/groupadd sftponly'
Debug: Success: /usr/sbin/groupadd sftponly
Debug: Executing: '/usr/bin/gpasswd -a larry sftponly'
Debug: Success: /usr/bin/gpasswd -a larry sftponly
...
Debug: Executing: '/usr/sbin/groupmod -m larry moe curly sftponly'
Error: Could not set members on group[sftponly]: Execution of '/usr/sbin/groupmod -m larry moe curly sftponly' returned 2: /usr/sbin/groupmod: invalid option -- 'm' 

Environment

  • Version [7.27.0]
  • Platform [RHEL 7.9]
  • libuser [0.60, x86_64]

Additional Context

A work around is to explicitly set provider => 'groupdadd'

$members = [ 'larry', 'moe', 'curly' ]

  group { 'sftponly':
    ensure          => 'present',
    auth_membership => true,
    members         => $members,
    forcelocal      => true,
    provider        => 'groupadd',
  } 

results in

Debug: Executing: '/usr/sbin/lgroupadd sftponly'
Debug: Executing: '/usr/sbin/lgroupmod -M larry moe curly sftponly'
@mojibake-umd mojibake-umd added the bug Something isn't working label May 16, 2024
@cthorn42 cthorn42 added the triaged Jira issue has been created for this label May 21, 2024
Copy link

Migrated issue to PUP-12045

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triaged Jira issue has been created for this
Projects
None yet
Development

No branches or pull requests

2 participants