Script to migrate YAML users to the INI format, so we can deprecate YAML inventory (which we are now doing).

This commit is contained in:
Michael DeHaan 2012-07-20 11:15:57 -04:00
commit 5a67a556cd
4 changed files with 213 additions and 2 deletions

View file

@ -46,6 +46,7 @@ class InventoryParser(object):
self._parse_group_children()
self._parse_group_variables()
return self.groups
# [webservers]
# alpha

View file

@ -20,12 +20,16 @@ from ansible.inventory.host import Host
from ansible.inventory.group import Group
from ansible import errors
from ansible import utils
import sys
class InventoryParserYaml(object):
''' Host inventory parser for ansible '''
def __init__(self, filename=C.DEFAULT_HOST_LIST):
sys.stderr.write("WARNING: YAML inventory files are deprecated in 0.6 and will be removed in 0.7, to migrate" +
" download and run https://github.com/ansible/ansible/blob/devel/examples/scripts/yaml_to_ini.py\n")
fh = open(filename)
data = fh.read()
fh.close()

View file

@ -508,8 +508,8 @@ class Runner(object):
if type(exec_rc) != ReturnData:
raise Exception("unexpected return type: %s" % type(exec_rc))
# redundant, right?
#if not exec_rc.comm_ok:
# self.callbacks.on_unreachable(host, exec_rc.result)
if not exec_rc.comm_ok:
self.callbacks.on_unreachable(host, exec_rc.result)
return exec_rc
except errors.AnsibleError, ae:
msg = str(ae)