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:
Erik Johnson 2018-05-09 10:13:05 -05:00
parent 85284caaf9
commit 9659b19819
No known key found for this signature in database
GPG key ID: 5E5583C437808F3F
2 changed files with 0 additions and 2 deletions

View file

@ -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

View file

@ -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):