create_group_model() doesn't handle undefined groups
whitlockjc opened this issue · comments
create_group_model
contains a test for each member of each group, that checks whether the member is really another group. However, get_dict_key_from_value
will return None
if the member is a group, but that group is not in the dictionary. This can happen if you start your search at a point in the tree below where the group is defined. At this point, create_group_model
tries to concatenate None
to the string GROUP:
, resulting in an exception.
This bit of code needs a trap for get_dict_key_from_value
returning None
:
key = get_dict_key_from_value(groupmap, mg[0][0][0])
if key == None:
if verbose:
print("[WARNING]: this member is a group, but the group is not in the group dictionary:" + mg[0][0][0])
else:
members.append("GROUP:" + key)