Fixes #8290 - dry up foreman_url logic in one place

depends on https://github.com/theforeman/foreman/pull/1902
everything below this line should be private methods I think