Incompatibility between SUSE Manager and Ansible versions equal to or lower than 2.9 due to python2-salt2
This document (000019845) is provided subject to the disclaimer at the end of this document.
Environment
Situation
These files set the value of yaml.safeloader=CSafeLoader, which takes effect globally and sets the YAML parser, on any app that imports this python.
Apparently, the C YAML parser is not 100% compatible with the default Python YAML parser, and enforcing this globally will break other code that imports this python salt plugin.
Ansible has a salt plugin which sources these python2-salt files and this therefore breaks ansible, eg:
https://github.com/ansible/ansible/issues/70357
"The salt python lib does yaml.SafeLoader = yaml.CSafeLoader which means it infects all uses of yaml.SafeLoader"
Ansible has worked around this salt bug in recent releases, however current Ansible 2.9 on RHEL does not contain this fix. This results in errors in all ansible code which uses the nice_yaml output plugin.
This will lead to no longer being able to register any server as a salt client.
Resolution
However, as a workaround, a patch was provided for being able to keep on using version 2.9 and lower. The patch can be found in the next code sample in a box below. It should be saved to a file, the name:
0001-Yaml-C-lib-is-no-longer-gets-used.patch
is suggested, but any other name should be fine. Here is the code sample:From 7c6690e3b81a39f94dc9b565908a12b05c193365 Mon Sep 17 00:00:00 2001 From: Jochen Breuer <jbreuer@suse.de> Date: Wed, 9 Dec 2020 14:30:01 +0100 Subject: [PATCH] Yaml C lib is no longer gets used --- salt/utils/yamlloader.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/salt/utils/yamlloader.py b/salt/utils/yamlloader.py index 0516647d1f..8828abbf3c 100644 --- a/salt/utils/yamlloader.py +++ b/salt/utils/yamlloader.py @@ -10,13 +10,6 @@ import warnings import yaml # pylint: disable=blacklisted-import from yaml.nodes import MappingNode, SequenceNode from yaml.constructor import ConstructorError -try: - yaml.Loader = yaml.CLoader - yaml.Dumper = yaml.CDumper - yaml.SafeLoader = yaml.CSafeLoader - yaml.SafeDumper = yaml.CSafeDumper -except Exception: # pylint: disable=broad-except - pass import salt.utils.stringutils -- 2.29.1In order to apply the patch, the following commands need to be run on the SUSE Manager:
cd /usr/lib/python<python-version>/site-packages/salt
patch < /path/to/0001-Yaml-C-lib-is-no-longer-gets-used.patch
The "patch" command will prompt user which file to patch, the file is:
salt/utils/yamlloader.pyAfterwards, a restart in salt-master will be needed:
systemctl restart salt-master.service
Cause
Status
Additional Information
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:000019845
- Creation Date: 25-Jan-2021
- Modified Date:26-Jan-2021
-
- SUSE Manager Server
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com