saltstack-formulas / openssh-formula

Home Page:http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deprecated iteritems() method not forward-compatible with Python 3

xenophonf opened this issue · comments

Formulas iterating over dictionaries should use the items() method instead of iteritems() because the latter method has been removed from Python 3. While the items() method in Python 2 uses more memory than iteritems(), these dictionaries are typically small (e.g., sets of settings from Pillar).

I suggest to use dictsort() jinja filter as both compatible and clear way to iterate through dictionaries in jinja, like this:

{%- for key, value in dict | dictsort -%}

Anyhow, @xenophonf, this issue could be closed now. Thanks.

Thank you!