Ensure that random filter isn't treated as a constant

pull/82224/head
Matt Martz 1 year ago
parent 451f4f9185
commit e20591d6dc
No known key found for this signature in database
GPG Key ID: 40832D88E9FC91D8

@ -21,7 +21,7 @@ from collections.abc import Mapping
from functools import partial
from random import Random, SystemRandom, shuffle
from jinja2.filters import pass_environment
from jinja2.filters import pass_environment, pass_context
from ansible.errors import AnsibleError, AnsibleFilterError, AnsibleFilterTypeError
from ansible.module_utils.six import string_types, integer_types, reraise, text_type
@ -230,8 +230,8 @@ def from_yaml_all(data):
return data
@pass_environment
def rand(environment, end, start=None, step=None, seed=None):
@pass_context
def rand(context, end, start=None, step=None, seed=None):
if seed is None:
r = SystemRandom()
else:

Loading…
Cancel
Save