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:
Tim Bielawa 2012-03-12 23:11:54 -04:00
parent ce85222fa6
commit dfd2c6dce3
4 changed files with 57 additions and 10 deletions

View file

@ -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'] = []