Jira (PUP-10997) User resource with forcelocal and groups attributes set will fail if /etc/group contains empty lines

11 views
Skip to first unread message

Grace Lee (Jira)

unread,
Mar 29, 2021, 3:45:02 AM3/29/21
to puppe...@googlegroups.com
Grace Lee created an issue
 
Puppet / Bug PUP-10997
User resource with forcelocal and groups attributes set will fail if /etc/group contains empty lines
Issue Type: Bug Bug
Affects Versions: PUP 6.21.0, PUP 7.4.0
Assignee: Unassigned
Created: 2021/03/29 12:44 AM
Priority: Normal Normal
Reporter: Grace Lee

Puppet Version: 7.4.0 and 6.21.0 (and later)
Puppet Server Version: Masterless to demonstrate issue
OS Name/Version: CentOS 7

A user resource with forcelocal => true and groups attributes set will fail if /etc/group contains any empty/blank lines

# egrep -n '^$|testuser' /etc/passwd /etc/group
/etc/passwd:24:testuser:x:1001:1001:testuser:/home/testuser:/bin/bash
/etc/group:41:centos:x:1000:testuser
/etc/group:42:testuser:x:1001:
/etc/group:43:
# grpck -r
invalid group file entry
delete line ''? No
grpck: no changes
# bundle exec puppet apply -e "user { 'testuser': groups => ['centos'], forcelocal => true}"
Notice: Compiled catalog for [redacted] in environment production in 0.02 seconds
Error: undefined method `split' for nil:NilClass
#

This is due to this line in localgroup method added for PUP-10857 in puppet 6.21.0 / puppet 7.4.0 and later

This does not occur in puppet 6.19.1 and earlier (example output from 6.16 agent)

# puppet --version
6.16.0
# puppet apply -e "user { 'testuser': groups => ['centos'], forcelocal => true}"
Notice: Compiled catalog for [redacted] in environment production in 0.04 seconds
Notice: Applied catalog in 0.06 seconds
#

While empty lines in /etc/group are technically not valid configuration, the behaviour change is difficult to diagnose as it occurs when the catalog is applied/enforced, and does not return much detail in the error.

Desired Behavior:

Ideally do not fail when empty lines are encountered, or at least output more detailed failure message.

Actual Behavior:

Error: undefined method `split' for nil:NilClass

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Grace Lee (Jira)

unread,
Mar 29, 2021, 4:10:03 AM3/29/21
to puppe...@googlegroups.com

Luchian Nemes (Jira)

unread,
Apr 9, 2021, 4:17:04 AM4/9/21
to puppe...@googlegroups.com
Luchian Nemes updated an issue
 
Change By: Luchian Nemes
Fix Version/s: PUP 6.22.0
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo

Luchian Nemes (Jira)

unread,
Apr 12, 2021, 3:06:01 AM4/12/21
to puppe...@googlegroups.com

Luchian Nemes (Jira)

unread,
Apr 12, 2021, 3:06:02 AM4/12/21
to puppe...@googlegroups.com

Claire Cadman (Jira)

unread,
Apr 12, 2021, 9:26:01 AM4/12/21
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages