| When creating a user/group resource on macOS Catalina, the directoryservice provider would fail with the following:
Debug: Failed with ArgumentError on : #<ArgumentError: invalid byte sequence in US-ASCII> |
Error: Could not prefetch user provider 'directoryservice': undefined method `each' for nil:NilClass
|
This issue is caused by the Puppet::Util::Plist.parse_plist method receiving XML plist_data in ASCII instead of UTF-8 encoding (see https://github.com/puppetlabs/puppet/blob/master/lib/puppet/provider/user/directoryservice.rb#L95 for an example). XML plists begin with <?xml version="1.0" encoding="UTF-8"?>. Based on this, we can force the encoding of the plist data to be UTF-8. We do this conditionally, since the parse_plist method can also be called with plist data in binary format. This issue seems to have been present from the beginning, but luckily no non-ASCII plist data snuck through until now. |