From e3aa73cb9781eef41504ca152b40c45f709e05df Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Thu, 31 Mar 2022 14:16:47 -0500 Subject: [PATCH] Catch ImportError when pyyaml doesn't have libyaml extension (#77434) --- lib/ansible/module_utils/common/yaml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/common/yaml.py b/lib/ansible/module_utils/common/yaml.py index f91bf1234d5..e79cc096420 100644 --- a/lib/ansible/module_utils/common/yaml.py +++ b/lib/ansible/module_utils/common/yaml.py @@ -27,7 +27,7 @@ if HAS_YAML: from yaml.cyaml import CParser as Parser HAS_LIBYAML = True - except AttributeError: + except (ImportError, AttributeError): from yaml import SafeLoader # type: ignore[misc] from yaml import SafeDumper # type: ignore[misc] from yaml.parser import Parser # type: ignore[misc]