Fixes #6560 - Extract puppet parsing logic

I think that this is the risk or downside of dynamic languages. We don't have abstract classes and methods. If you think this is an issue and we should implement it in ruby, I'd suggest creating a new redmine issue to fix this in whole Foreman. Same pattern is used elsewhere https://github.com/theforeman/foreman/blob/develop/app/services/classification/base.rb#L12 https://github.com/theforeman/foreman/blob/develop/app/services/fact_importer.rb#L33 https://github.com/theforeman/foreman/blob/develop/app/services/sso/base.rb#L36 https://github.com/theforeman/foreman/blob/develop/app/controllers/api/base_controller.rb#L176 and fixing all of it is out of scope for this PR.