From 9d48ba4243ebae6cca9162a11e0d919dea75f8c4 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 4 Sep 2019 13:16:55 -0400 Subject: [PATCH] better error message on missing runner --- awx/plugins/isolated/awx_capacity.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/awx/plugins/isolated/awx_capacity.py b/awx/plugins/isolated/awx_capacity.py index ccfc332b8cff..212025544ab8 100644 --- a/awx/plugins/isolated/awx_capacity.py +++ b/awx/plugins/isolated/awx_capacity.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . +from ansible.module_utils._text import to_text from ansible.module_utils.basic import AnsibleModule import subprocess @@ -48,13 +49,16 @@ def main(): module = AnsibleModule( argument_spec = dict() ) + + ar = module.get_bin_path('ansible-runner', required=True) + try: version = subprocess.check_output( - ['ansible-runner', '--version'], + [ar, '--version'], stderr=subprocess.STDOUT ).strip() except subprocess.CalledProcessError as e: - module.fail_json(msg=str(e)) + module.fail_json(msg=to_text(e)) return # NOTE: Duplicated with awx.main.utils.common capacity utilities cpu, capacity_cpu = get_cpu_capacity()