Reduce code duplication in kolla-common.sh

Introduce a generic check_for_os_service function that exits unless it
receives a successful response from the corresponding OpenStack service.

Additionally use the local keyword to not leak local variables, and fix
check for non-existing NEUTRON_API_SERVICE_HOST variable in
check_for_neutron().

Change-Id: I67dff2b16a99bc44e928cd6a679dff8cc6a99b39
Merge "Reduce code duplication in kolla-common.sh"