Refactored puppet-apply script. Will return status code fo the puppet apply command.