Sergey's idea is to use temporary xml file. He runs command to get cib xml dump and redirects it to this file. Then just opens this file and reads it's content. He does it to solve problems we have been haveing with popen3 and debugging is only side effect of this change. Using temporyry files in synchronus process? Why not, it's ok.
Yes, we have already found out there popen3 promlems are causes by missing read call, but Sergey didn't know about it when this code was written and he used another solution.
Ivan suggests to use popen3 with read to get xml content and use Puppet.debug to log debugging information.
It's a good solution too. But xml dumps are a bit to large to be logged so Ivan have made logging of crm status in puppet debug log.

So in my opinion both solutions are ok.