mirror of https://github.com/ansible/ansible.git
Update argspec to normalize across platforms (#59596)
Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>pull/58954/head
parent
cf9999692a
commit
3da4c0dd3a
@ -0,0 +1,32 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2019 Red Hat
|
||||
# GNU General Public License v3.0+
|
||||
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
# utils
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible.module_utils.six import iteritems
|
||||
|
||||
|
||||
def search_obj_in_list(name, lst, key='name'):
|
||||
for item in lst:
|
||||
if item[key] == name:
|
||||
return item
|
||||
return None
|
||||
|
||||
|
||||
def flatten_dict(x):
|
||||
result = {}
|
||||
if not isinstance(x, dict):
|
||||
return result
|
||||
|
||||
for key, value in iteritems(x):
|
||||
if isinstance(value, dict):
|
||||
result.update(flatten_dict(value))
|
||||
else:
|
||||
result[key] = value
|
||||
|
||||
return result
|
Loading…
Reference in New Issue