Remove "flaten" outputter

This is being moved to salt-contrib and renamed to "flatten" to fix the
spelling mistake. It needs some refinement before if can be officially
released.
This commit is contained in:
Erik Johnson 2014-08-22 12:02:35 -05:00
parent 4267e08512
commit edb07d5ef0

View File

@ -1,53 +0,0 @@
# -*- coding: utf-8 -*-
'''
Display data
=================================
Example input::
{'myminion':
{'foo':
{'list': ['Hello', 'World'],
'bar': 'baz',
'dictionary': {'abc': 123, 'def': 456}
}
}
'second-minion':
{'bar':
{'list': ['Hello', 'World'],
'bar': 'baz',
'dictionary': {'abc': 123, 'def': 456}
}
}
}
Example output::
{'bar': 'baz', 'list': ['Hello', 'World'], 'dictionary': {'abc': 123, 'def': 456}}
{'bar': 'baz', 'list': ['Hello', 'World'], 'dictionary': {'abc': 123, 'def': 456}}
'''
def string_list(a_list):
return [str(item) for item in a_list]
def get_values(data):
l = []
items = data.values()
for item in items:
if isinstance(item, dict):
l.extend(item.values())
else:
l.append(item)
return l
def output(data):
'''
Rather basic....
'''
# return one_level_values(data)
return '\n'.join(string_list(get_values(data)))