fixes #2439 - puppetrun API added.

this pr replaces @arnoudj's two commit from pr #636
closing pr #636