fixes #2539 - puppetrun API added.

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