mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 19:20:22 -07:00
Implement friendlier error handling.
Generic AnsibleError exception + host inventory missing exception. First shot at catching these in a generic way in bin/ansible*.
This commit is contained in:
parent
ce85222fa6
commit
dfd2c6dce3
4 changed files with 57 additions and 10 deletions
|
@ -39,6 +39,8 @@ import random
|
|||
import jinja2
|
||||
import time
|
||||
from ansible.utils import *
|
||||
from ansible.errors import AnsibleInventoryNotFoundError
|
||||
|
||||
|
||||
################################################
|
||||
|
||||
|
@ -127,6 +129,10 @@ class Runner(object):
|
|||
return (host_list, {})
|
||||
|
||||
host_list = os.path.expanduser(host_list)
|
||||
|
||||
if not os.path.exists(host_list):
|
||||
raise AnsibleInventoryNotFoundError(host_list)
|
||||
|
||||
lines = file(host_list).read().split("\n")
|
||||
groups = {}
|
||||
groups['ungrouped'] = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue