Push an element onto an array that may not have been defined in the dict
(self, my_dict, key, element)
| 1361 | return self.json_format_dict(self.get_host_info_dict_from_instance(instance), True) |
| 1362 | |
| 1363 | def push(self, my_dict, key, element): |
| 1364 | ''' Push an element onto an array that may not have been defined in |
| 1365 | the dict ''' |
| 1366 | group_info = my_dict.setdefault(key, []) |
| 1367 | if isinstance(group_info, dict): |
| 1368 | host_list = group_info.setdefault('hosts', []) |
| 1369 | host_list.append(element) |
| 1370 | else: |
| 1371 | group_info.append(element) |
| 1372 | |
| 1373 | def push_group(self, my_dict, key, element): |
| 1374 | ''' Push a group as a child of another group. ''' |
no outgoing calls