Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate jinja filters for neon #55614

Merged
merged 4 commits into from
Dec 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions doc/topics/jinja/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ Example:
Renamed from ``json_decode_list`` to ``json_encode_list``. When you encode
something you get bytes, and when you decode, you get your locale's
encoding (usually a ``unicode`` type). This filter was incorrectly-named
when it was added. ``json_decode_list`` will be supported until the Neon
when it was added. ``json_decode_list`` will be supported until the Aluminium
release.
.. deprecated:: 2018.3.3,2019.2.0
The :jinja_ref:`tojson` filter accomplishes what this filter was designed
Expand Down Expand Up @@ -947,7 +947,7 @@ Returns:
Renamed from ``json_decode_dict`` to ``json_encode_dict``. When you encode
something you get bytes, and when you decode, you get your locale's
encoding (usually a ``unicode`` type). This filter was incorrectly-named
when it was added. ``json_decode_dict`` will be supported until the Neon
when it was added. ``json_decode_dict`` will be supported until the Aluminium
release.
.. deprecated:: 2018.3.3,2019.2.0
The :jinja_ref:`tojson` filter accomplishes what this filter was designed
Expand Down Expand Up @@ -995,8 +995,8 @@ installed, then the upstream version of the filter will be used. See the
.. versionadded:: 2017.7.0
.. versionadded:: 2018.3.0
Renamed from ``rand_str`` to ``random_hash`` to more accurately describe
what the filter does. ``rand_str`` will be supported until the Neon
release.
what the filter does. ``rand_str`` will be supported to ensure backwards
compatibility but please use the preferred ``random_hash``.

Generates a random number between 1 and the number passed to the filter, and
then hashes it. The default hash type is the one specified by the minion's
Expand Down
8 changes: 4 additions & 4 deletions salt/utils/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ def encode(data, encoding=None, errors='strict', keep=False,
return data


@jinja_filter('json_decode_dict') # Remove this for Neon
@jinja_filter('json_encode_dict') # Remove this for Neon
@jinja_filter('json_decode_dict') # Remove this for Aluminium
@jinja_filter('json_encode_dict')
def encode_dict(data, encoding=None, errors='strict', keep=False,
preserve_dict_class=False, preserve_tuples=False):
'''
Expand Down Expand Up @@ -412,8 +412,8 @@ def encode_dict(data, encoding=None, errors='strict', keep=False,
return rv


@jinja_filter('json_decode_list') # Remove this for Neon
@jinja_filter('json_encode_list') # Remove this for Neon
@jinja_filter('json_decode_list') # Remove this for Aluminium
@jinja_filter('json_encode_list')
def encode_list(data, encoding=None, errors='strict', keep=False,
preserve_dict_class=False, preserve_tuples=False):
'''
Expand Down
1 change: 1 addition & 0 deletions salt/utils/hashutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def hmac_compute(string, shared_secret):
return hmac_hash


@jinja_filter('rand_str')
@jinja_filter('random_hash')
def random_hash(size=9999999999, hash_type=None):
'''
Expand Down
8 changes: 0 additions & 8 deletions salt/utils/jinja.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,14 +564,6 @@ def lst_avg(lst):

2.5
'''
salt.utils.versions.warn_until(
'Neon',
'This results of this function are currently being rounded.'
'Beginning in the Salt Neon release, results will no longer be '
'rounded and this warning will be removed.',
stacklevel=3
)

if not isinstance(lst, collections.Hashable):
return float(sum(lst)/len(lst))
return float(lst)
Expand Down
2 changes: 1 addition & 1 deletion salt/utils/stringutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def _normalize(s):
raise TypeError('expected str, bytes, or bytearray not {}'.format(type(s)))


@jinja_filter('str_to_num') # Remove this for Neon
@jinja_filter('str_to_num')
@jinja_filter('to_num')
def to_num(text):
'''
Expand Down