mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-22 14:01:42 -07:00
Break apart a looped dependency to show a warning when parsing playbooks
Display a warning when a dict key is overwritten by pyyaml Fixes #12888
This commit is contained in:
parent
57fe0d6aed
commit
4203850d1a
18 changed files with 373 additions and 311 deletions
|
@ -23,6 +23,7 @@ import re
|
|||
import codecs
|
||||
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.parsing.quoting import unquote
|
||||
|
||||
# Decode escapes adapted from rspeer's answer here:
|
||||
# http://stackoverflow.com/questions/4020539/process-escape-sequences-in-a-string-in-python
|
||||
|
@ -263,12 +264,3 @@ def split_args(args):
|
|||
raise Exception("error while splitting arguments, either an unbalanced jinja2 block or quotes")
|
||||
|
||||
return params
|
||||
|
||||
def is_quoted(data):
|
||||
return len(data) > 1 and data[0] == data[-1] and data[0] in ('"', "'") and data[-2] != '\\'
|
||||
|
||||
def unquote(data):
|
||||
''' removes first and last quotes from a string, if the string starts and ends with the same quotes '''
|
||||
if is_quoted(data):
|
||||
return data[1:-1]
|
||||
return data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue