mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 22:37:41 -02:30
Merge pull request #4659 from bcoca/nicer_error
better error message on missing runner Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from ansible.module_utils._text import to_text
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
@@ -48,13 +49,16 @@ def main():
|
|||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict()
|
argument_spec = dict()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ar = module.get_bin_path('ansible-runner', required=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
version = subprocess.check_output(
|
version = subprocess.check_output(
|
||||||
['ansible-runner', '--version'],
|
[ar, '--version'],
|
||||||
stderr=subprocess.STDOUT
|
stderr=subprocess.STDOUT
|
||||||
).strip()
|
).strip()
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=to_text(e))
|
||||||
return
|
return
|
||||||
# NOTE: Duplicated with awx.main.utils.common capacity utilities
|
# NOTE: Duplicated with awx.main.utils.common capacity utilities
|
||||||
cpu, capacity_cpu = get_cpu_capacity()
|
cpu, capacity_cpu = get_cpu_capacity()
|
||||||
|
|||||||
Reference in New Issue
Block a user