mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
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:
parent
4267e08512
commit
edb07d5ef0
@ -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)))
|
Loading…
Reference in New Issue
Block a user