Fixed based on PR comments
Fixed based on PR comments

https://bugzilla.redhat.com/show_bug.cgi?id=1258648

Combined the shared code in invoke_external and run_ruby_method into
a new function called run_method. Added a new function that does the
cleanup (terminate the process and exit the threads)


(transferred from ManageIQ/manageiq@88232c7214a6070e88856a3c64b4c61ed3e67574)

bdunne/manageiq-automation_engine