@johnj gah, we fell at the last hurdle! This script switches to an unpriviledged user but doesn't reset $HOME so Facter tries to read /root as another user and crashes. Could you add

    ENV['HOME'] = '/etc/puppet' # Otherwise facter tries to read /root as puppetuser

At line 294 (just after Process::UID) ? That should fix it.