

def do_debug():
    master_dir = c.find_master_dir(os.getcwd())
    c.set_master_dir(master_dir)
    (global_config, user_config, combined) = c.load_user_config()
    if ('HOSTS' not in combined):
        print('"HOSTS" record not found in your config files. (case sensitive)')
        return False
    r = True
    hosts = combined['HOSTS']
    print('Processed HOSTS record:\n{0}\n'.format(pformat({
        'HOSTS': hosts,
    })))
    if (type(hosts) != dict):
        print('"HOSTS" should be a dict / hash. It is currently a: {0}'.format(type(hosts)))
        return False
    for (host, rec) in hosts.items():
        if (type(rec) != dict):
            print('Host "{0}" >> Each "host" record should be a dict / hash. It is currently a: {1}'.format(host, type(rec)))
            r = False
        elif ('hosts' not in rec):
            print('Host "{0}" >> "hosts" key not found.'.format(host))
            r = False
        elif (type(rec['hosts']) != list):
            print('Host "{0}" >> Each "hosts" record should be a list. It is currently a: {1}'.format(host, type(rec['hosts'])))
            r = False
        if (type(rec) is dict):
            if ('vars' not in rec):
                print('Host "{0}" >> "vars" not found (case sensitive).'.format(host))
                r = False
            elif (type(rec['vars']) != dict):
                print('Host "{0}" >> Each "vars" record should be a dict / hash. It is currently a: {1}'.format(host, type(rec['vars'])))
                r = False
    if r:
        print('Debug checks passed.  If it is still not working, good luck with your debugging! \nCheck the ansible documentation here: http://docs.ansible.com/developing_inventory.html\nOr try parsing it with an online yaml parser like: http://yaml-online-parser.appspot.com/\n\t(try the python output format)\n')
    return r

dataset/ETHPy150Open rr326/servi/servi/commands/inventory.py do_debug/original