mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix for # in inner strings in yaml arguments
Fixes #18045 The fix for #8585 should still be intact
This commit is contained in:
parent
ced558a6e6
commit
2e0609f09e
1 changed files with 6 additions and 3 deletions
|
@ -106,9 +106,12 @@ def yamlify_arg(arg):
|
|||
import salt.utils.yamlloader as yamlloader
|
||||
original_arg = arg
|
||||
if '#' in arg:
|
||||
# Don't yamlify this argument or the '#' and everything after
|
||||
# it will be interpreted as a comment.
|
||||
return arg
|
||||
# Only yamlify if it parses into a non-string type, to prevent
|
||||
# loss of content due to # as comment character
|
||||
parsed_arg = yamlloader.load(arg, Loader=yamlloader.SaltYamlSafeLoader)
|
||||
if isinstance(parsed_arg, string_types):
|
||||
return arg
|
||||
return parsed_arg
|
||||
if arg == 'None':
|
||||
arg = None
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue