CLOUDSTACK-5674: Fix get_domain and remove dependency on ostype in get_template