mirror of https://github.com/jumpserver/jumpserver
fix: 修复ansible 任务 {{123}} 这样的密码失败问题
parent
1afad40dd3
commit
da8d78f384
|
@ -128,13 +128,19 @@ class Account(AbsConnectivity, LabeledMixin, BaseAccount):
|
|||
if not isinstance(value, str):
|
||||
return value
|
||||
|
||||
value = value.replace('{{', '__TEMP_OPEN_BRACES__') \
|
||||
.replace('}}', '__TEMP_CLOSE_BRACES__')
|
||||
def escape(v):
|
||||
v = v.replace('{{', '__TEMP_OPEN_BRACES__') \
|
||||
.replace('}}', '__TEMP_CLOSE_BRACES__')
|
||||
|
||||
value = value.replace('__TEMP_OPEN_BRACES__', '{{ "{{" }}') \
|
||||
.replace('__TEMP_CLOSE_BRACES__', '{{ "}}" }}')
|
||||
v = v.replace('__TEMP_OPEN_BRACES__', '{{ "{{" }}') \
|
||||
.replace('__TEMP_CLOSE_BRACES__', '{{ "}}" }}')
|
||||
|
||||
return value.replace('{%', '{{ "{%" }}').replace('%}', '{{ "%}" }}')
|
||||
return v.replace('{%', '{{ "{%" }}').replace('%}', '{{ "%}" }}')
|
||||
|
||||
if value.startswith('{{') and value.endswith('}}'):
|
||||
return '{{' + escape(value[2:-2]) + '}}'
|
||||
else:
|
||||
return escape(value)
|
||||
|
||||
|
||||
def replace_history_model_with_mixin():
|
||||
|
|
Loading…
Reference in New Issue