While in the process of purging role::puppet::self, I note that it's referred to in puppet_ssldir.rb. Role::puppet::self hasn't been used for ages -- that makes me think this function is probably broken in some cases.
If this code is still needed, the fix is probably just to look for the hiera var 'puppetmaster'.