Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2040602

Summary: DeprecationWarning from /usr/lib64/python3.6/site-packages/_yaml/__init__.py:23
Product: Red Hat OpenStack Reporter: Harald Jensås <hjensas>
Component: ansibleAssignee: OSP Team <rhos-maint>
Status: CLOSED DUPLICATE QA Contact: nlevinki <nlevinki>
Severity: low Docs Contact:
Priority: high    
Version: 17.0 (Wallaby)CC: apevec, aschultz, jjoyce, jpichon, jschluet, lhh, slinaber, tvignaud
Target Milestone: AlphaKeywords: TestBlocker
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-01-14 15:19:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Harald Jensås 2022-01-14 08:24:23 UTC
Description of problem:
Every openstack cli command executed prints this deprecation warning:

> DeprecationWarning: The _yaml extension module is now located at
> yaml._yaml and its location is subject to change.  To use the
> LibYAML-based parser and emitter, import from `yaml`: `from yaml
> import CLoader as Loader, CDumper as Dumper`.\n
> DeprecationWarning\n0'

Version-Release number of selected component (if applicable):
python3-openstackclient-5.5.1-0.20210904061812.53f1efa.el8ost.noarch.rpm  

How reproducible:
100% 

Steps to Reproduce:
1. Deploy OSP-17 undercloud
2. Run any command such as "openstack port list", "openstack baremetal node list"
3.

Actual results:
The DeprecationWarning from: 
/usr/lib64/python3.6/site-packages/_yaml/__init__.py:23

Expected results:
The client should not print a deprecation warning.

Additional info:

This is breaking downstream CI scripts which expect no "fuzz" in STDOUT/STDERR.

Chances are it will also break customer scripts as well.

Comment 1 Harald Jensås 2022-01-14 08:48:20 UTC
Actually this error is in ansible, and most likely seen in OSP-17 undercloud because of tripleoclient's imports from ansible[1]:

from ansible.parsing.dataloader import DataLoader
from ansible.inventory.manager import InventoryManager

I'm changing component to ansible.


This patch fixes the problem:

diff --git a/ansible/parsing/yaml/loader.py.orig b/ansible/parsing/yaml/loader.py
index b665004..a52a424 100644
--- a/ansible/parsing/yaml/loader.py.orig
+++ b/ansible/parsing/yaml/loader.py
@@ -20,7 +20,7 @@ from __future__ import (absolute_import, division, print_function)
 __metaclass__ = type
 
 try:
-    from _yaml import CParser, CEmitter
+    from yaml._yaml import CParser, CEmitter
     HAVE_PYYAML_C = True
 except ImportError:
     HAVE_PYYAML_C = False


[1] https://opendev.org/openstack/python-tripleoclient/src/branch/master/tripleoclient/utils.py#L49

Comment 3 Alex Schultz 2022-01-14 15:19:45 UTC

*** This bug has been marked as a duplicate of bug 2034555 ***