mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add alternative fix for "!" stomping
Apparently (after watching Jenkins tests fail), what yaml.safe_load returns depends not on the version of salt, but on some other external dependency. Because of this, fix both possible return values.
This commit is contained in:
parent
c95dd4d70f
commit
93bd30df0e
1 changed files with 4 additions and 1 deletions
|
@ -200,13 +200,16 @@ def yamlify_arg(arg):
|
|||
|
||||
elif arg is None \
|
||||
or isinstance(arg, (list, float, six.integer_types, six.string_types)):
|
||||
# yaml.safe_load will load '|' as '', don't let it do that.
|
||||
# yaml.safe_load will load '|' and '!' as '', don't let it do that.
|
||||
if arg == '' and original_arg in ('|', '!'):
|
||||
return original_arg
|
||||
# yaml.safe_load will treat '#' as a comment, so a value of '#'
|
||||
# will become None. Keep this value from being stomped as well.
|
||||
elif arg is None and original_arg.strip().startswith('#'):
|
||||
return original_arg
|
||||
# Other times, yaml.safe_load will load '!' as None. Prevent that.
|
||||
elif arg is None and original_arg == '!':
|
||||
return original_arg
|
||||
else:
|
||||
return arg
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue