mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-04 07:24:00 -07:00
parent
ee080eddb5
commit
e8897a9b91
1 changed files with 6 additions and 1 deletions
|
@ -193,6 +193,11 @@ def regex_escape(string):
|
||||||
'''Escape all regular expressions special characters from STRING.'''
|
'''Escape all regular expressions special characters from STRING.'''
|
||||||
return re.escape(string)
|
return re.escape(string)
|
||||||
|
|
||||||
|
def from_yaml(data):
|
||||||
|
if isinstance(data, string_types):
|
||||||
|
return yaml.safe_load(data)
|
||||||
|
return data
|
||||||
|
|
||||||
@environmentfilter
|
@environmentfilter
|
||||||
def rand(environment, end, start=None, step=None):
|
def rand(environment, end, start=None, step=None):
|
||||||
r = SystemRandom()
|
r = SystemRandom()
|
||||||
|
@ -402,7 +407,7 @@ class FilterModule(object):
|
||||||
# yaml
|
# yaml
|
||||||
'to_yaml': to_yaml,
|
'to_yaml': to_yaml,
|
||||||
'to_nice_yaml': to_nice_yaml,
|
'to_nice_yaml': to_nice_yaml,
|
||||||
'from_yaml': yaml.safe_load,
|
'from_yaml': from_yaml,
|
||||||
|
|
||||||
#date
|
#date
|
||||||
'to_datetime': to_datetime,
|
'to_datetime': to_datetime,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue