mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
salt.serializers.yaml/yamlex: remove invalid multi_constructor
The first argument to add_multi_constructor must be a YAML tag. This is because when PyYAML looks for a constructor to match the tag (in order to get the function to use for deserialization) it matches the tag using `.startswith()`. Thus, when this is attempted using a constructor with a tag value of `None`, an error is raised. The ordering of the list of multi_constructors in the Loader object appears to differ from platform to platform, which explains why this only caused the unit tests to fail on one or two platforms. If a tag match is found, then PyYAML stops iterating through the list of multi_constructors, so this invalid one has been able to stay in Salt without causing any noticeable trouble until now.
This commit is contained in:
parent
85284caaf9
commit
9659b19819
2 changed files with 0 additions and 2 deletions
|
@ -108,7 +108,6 @@ Loader.add_multi_constructor('tag:yaml.org,2002:set', Loader.construct_yaml_set)
|
|||
Loader.add_multi_constructor('tag:yaml.org,2002:str', Loader.construct_yaml_str)
|
||||
Loader.add_multi_constructor('tag:yaml.org,2002:seq', Loader.construct_yaml_seq)
|
||||
Loader.add_multi_constructor('tag:yaml.org,2002:map', Loader.construct_yaml_map)
|
||||
Loader.add_multi_constructor(None, Loader.construct_undefined)
|
||||
|
||||
|
||||
class Dumper(BaseDumper): # pylint: disable=W0232
|
||||
|
|
|
@ -322,7 +322,6 @@ Loader.add_multi_constructor('tag:yaml.org,2002:pairs', Loader.construct_yaml_pa
|
|||
Loader.add_multi_constructor('tag:yaml.org,2002:set', Loader.construct_yaml_set)
|
||||
Loader.add_multi_constructor('tag:yaml.org,2002:seq', Loader.construct_yaml_seq)
|
||||
Loader.add_multi_constructor('tag:yaml.org,2002:map', Loader.construct_yaml_map)
|
||||
Loader.add_multi_constructor(None, Loader.construct_undefined)
|
||||
|
||||
|
||||
class SLSMap(OrderedDict):
|
||||
|
|
Loading…
Add table
Reference in a new issue