summaryrefslogtreecommitdiff
path: root/changelogs
diff options
context:
space:
mode:
authorGonéri Le Bouder <goneri@lebouder.net>2021-04-12 21:56:50 -0400
committerGitHub <noreply@github.com>2021-04-12 20:56:50 -0500
commitf4ec55b2d8f5c6e56a336e969dc76518e852cc75 (patch)
treee6ed2e92df2df181b6cd847e83afaedad2001bd9 /changelogs
parentcc97479f9de64ce01d911145e4262d39899e98a7 (diff)
downloadansible-f4ec55b2d8f5c6e56a336e969dc76518e852cc75.tar.gz
[stable-2.9] validate_modules: fails with .id attribute not found (#73322) (#74179)
* validate_modules: fails with .id attribute not found This patch addresses a problem in the `found_try_except_import` test. This module tries to identify lines like: `HAS_FOO = True` In this case, the target (`HAS_FOO`) is of type `ast.Name` and has a `id` attribute which provide the name. In my case, I've a line that set a module attribute`. In this case, the target (`module.var`) has the type `ast.Attribute` and no `id` attribute. The code trigger an `AttributeError` exception. This patch ensures we compare a `ast.Name`. * Update test/lib/ansible_test/_data/sanity/validate-modules/validate_modules/main.py (cherry picked from commit 7cf80f50d16b7a7a2ba9f1318bdca5df53936369)
Diffstat (limited to 'changelogs')
-rw-r--r--changelogs/fragments/validate-modules_found_try_except_import_fails_module_attribute.yaml3
1 files changed, 3 insertions, 0 deletions
diff --git a/changelogs/fragments/validate-modules_found_try_except_import_fails_module_attribute.yaml b/changelogs/fragments/validate-modules_found_try_except_import_fails_module_attribute.yaml
new file mode 100644
index 0000000000..b14be52a3f
--- /dev/null
+++ b/changelogs/fragments/validate-modules_found_try_except_import_fails_module_attribute.yaml
@@ -0,0 +1,3 @@
+---
+bugfixes:
+- validate-modules - do not raise an ``AttributeError`` if a value is assigned to a module attribute in a try/except block.