[PUP-7241] AIX - Errors when parsing lsuser output with special characters (#!) Created: 2017/02/21  Updated: 2018/09/11  Resolved: 2018/09/11

Status: Resolved
Project: Puppet
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Normal
Reporter: Rodney Treweek Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: aix, maintenance, type_and_provider, user
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

AIX, PE 2016.4.0+

Issue Links:
is blocked by PUP-9049 Refactor the AIX user/group providers Resolved
Template: PUP Bug Template
Epic Link: who USERs AIX anyway?
Team: Platform OS
Sprint: Platform OS Kanban
Method Found: Customer Feedback
QA Risk Assessment: Needs Assessment


When attempting to manage a user on AIX, the puppet agent runs fail with the following error.

Error: /User[username]: Could not evaluate: undefined method `to_sym' for nil:NilClass

The problem is occurring when the attributes have an odd number of colons in the output of lsuser -c.

Reproduction Steps

This can be reproduced with following these steps:
1. Login to the AIX node with an IPv6 address
2. Run the puppet agent

Technical details

The host_last_login from lsuser -c -R files username contains : characters, which are not parsed properly since it is a colon seperated list. This fails in <https://github.com/puppetlabs/puppet/blob/master/lib/puppet/provider/aixobject.rb#L199>. A IPv6 address of the form 2001:0db8:85a3:0000:0000:8a2e:0370:7334 will need to have the : escaped to fit into a colon separated list. Since the regex does not account for these escaped characters, the property list has more values than keys (i.e 8a2e would be a value without a key).

Proposed fix
Use lsuser -f instead of lsuser -c to output a list of attribute pairs instead of a colon list, as it should automatically use parse_attr_list instead. Since lsuser -f will not have to escape the colons, this issue should no longer be seen.

Comment by Moses Mendoza [ 2017/02/22 ]

Rodney Treweek thanks for filing. Added to queue. We try to eventually open all PUP project issues to the public, and I see this one has customer data attached which would prevent that. Is there any way you could file a public PUP ticket without customer-specific information that details the problem? We'll use this to publicly track the fix on github.com puppet

Comment by Tommy McNeely [ 2018/08/02 ]

It appears that the colons are escaped with "#!" in an IPv6 address.

# /usr/sbin/lsuser -c -R files root

Comment by Casey Williams [ 2018/08/14 ]

This is addressed as part of a PR for PUP-9049 and PUP-3021 here

Generated at Tue Nov 19 14:46:47 PST 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.