Refactor: scheduler: functionize parsing result from action history
... for code isolation and readability. Do the checks that can lead to early
returns first, for efficiency. Also improve log messages.
One slight change is that an invalid exit status will get mapped to 1
(CRM_EX_ERROR) rather than -1, but the behavior should be the same.