Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
salt.serializers.yaml/yamlex: remove invalid multi_constructor #47568
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
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.
Additionally, this PR adds some exception logging to aid in troubleshooting, since we re-raise our own exception classes using the caught exception message, which means we lose the context of what actually raised the original exception.