Externalize gathering of job info in its own function
Externalize gathering of job info in its own function

This commit externalize the gathering of job info in a function rather
that in the main function, so that visually the main is only about the
core of what the agent would be running.

Change-Id: If84ac0490ccdd439f31364fc0513a54216db0a8c

redhat-cip/dci-agent