Always use an ordered dict for yaml renderer

This commit is contained in:
Thomas S Hatch 2013-07-12 22:23:37 -06:00
parent 5d806a9f9e
commit 79fed61dc4

View File

@ -13,22 +13,12 @@ log = logging.getLogger(__name__)
def get_yaml_loader(argline):
try:
opts, args = getopt.getopt(argline.split(), 'o')
except getopt.GetoptError:
log.error(
'''Example usage: #!yaml [-o]
Options:
-o Use OrderedDict for YAML map and omap.
This option is only useful when combined with another renderer that
takes advantage of the ordering.
''')
raise
if ('-o', '') in opts:
def Loader(*args): # pylint: disable=C0103
return CustomLoader(*args, dictclass=OrderedDict)
return Loader
return CustomLoader
'''
Return the ordered dict yaml loader
'''
def yaml_loader(*args):
return CustomLoader(*args, dictclass=OrderedDict)
return yaml_loader
def render(yaml_data, env='', sls='', argline='', **kws):