@ -59,6 +59,7 @@ all: # keys must be unique, i.e. only one 'hosts' per group
'''
'''
import os
import os
from collections import MutableMapping
from collections import MutableMapping
from ansible . errors import AnsibleParserError
from ansible . errors import AnsibleParserError
@ -112,10 +113,11 @@ class InventoryModule(BaseFileInventoryPlugin):
def _parse_group ( self , group , group_data ) :
def _parse_group ( self , group , group_data ) :
if isinstance ( group_data , MutableMapping ) :
if isinstance ( group_data , ( MutableMapping , type ( None ) ) ) :
self . inventory . add_group ( group )
self . inventory . add_group ( group )
if group_data is not None :
# make sure they are dicts
# make sure they are dicts
for section in [ ' vars ' , ' children ' , ' hosts ' ] :
for section in [ ' vars ' , ' children ' , ' hosts ' ] :
if section in group_data :
if section in group_data :
@ -123,7 +125,7 @@ class InventoryModule(BaseFileInventoryPlugin):
if isinstance ( group_data [ section ] , string_types ) :
if isinstance ( group_data [ section ] , string_types ) :
group_data [ section ] = { group_data [ section ] : None }
group_data [ section ] = { group_data [ section ] : None }
if not isinstance ( group_data [ section ] , MutableMapping ) :
if not isinstance ( group_data [ section ] , ( MutableMapping , type ( None ) ) ) :
raise AnsibleParserError ( ' Invalid " %s " entry for " %s " group, requires a dictionary, found " %s " instead. ' %
raise AnsibleParserError ( ' Invalid " %s " entry for " %s " group, requires a dictionary, found " %s " instead. ' %
( section , group , type ( group_data [ section ] ) ) )
( section , group , type ( group_data [ section ] ) ) )