From 171ef3e337ae6d1696249a372938a266ee704074 Mon Sep 17 00:00:00 2001 From: Will Thames Date: Thu, 23 May 2019 03:08:01 +1000 Subject: [PATCH] Allow python_requirements_facts to have dashes (#56683) * Allow python_requirements_facts to cope with packages with dashes ``` python_requirements_facts: dependencies: - kubernetes-validate ``` should work as expected (cherry picked from commit 5b3305c71505ffd4b0fd7dc5a6a17a4d5cb4cd77) * Allow python_requirements_facts to cope with packages with dashes (#56166) * Allow python_requirements_facts to cope with packages with dashes ``` python_requirements_facts: dependencies: - kubernetes-validate ``` should work as expected * Ensure tests run for python_requirements_facts (cherry picked from commit 8e1dd58c2b4320b8900d7ce1d53e386ee81dcc8d) --- changelogs/fragments/python_requirements_facts_dashes.yml | 2 ++ lib/ansible/modules/system/python_requirements_facts.py | 2 +- test/integration/targets/python_requirements_facts/aliases | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/python_requirements_facts_dashes.yml diff --git a/changelogs/fragments/python_requirements_facts_dashes.yml b/changelogs/fragments/python_requirements_facts_dashes.yml new file mode 100644 index 00000000000..725906dd21a --- /dev/null +++ b/changelogs/fragments/python_requirements_facts_dashes.yml @@ -0,0 +1,2 @@ +bugfixes: + - allow python_requirements_facts to report on dependencies containing dashes diff --git a/lib/ansible/modules/system/python_requirements_facts.py b/lib/ansible/modules/system/python_requirements_facts.py index 6e76665fae3..2066b4cdfcc 100644 --- a/lib/ansible/modules/system/python_requirements_facts.py +++ b/lib/ansible/modules/system/python_requirements_facts.py @@ -123,7 +123,7 @@ def main(): python_version=sys.version, python_system_path=sys.path, ) - pkg_dep_re = re.compile(r'(^[a-zA-Z][a-zA-Z0-9_]+)(==|[><]=?)?([0-9.]+)?$') + pkg_dep_re = re.compile(r'(^[a-zA-Z][a-zA-Z0-9_-]+)(==|[><]=?)?([0-9.]+)?$') results = dict( not_found=[], diff --git a/test/integration/targets/python_requirements_facts/aliases b/test/integration/targets/python_requirements_facts/aliases index ad7ccf7ada2..765b70da796 100644 --- a/test/integration/targets/python_requirements_facts/aliases +++ b/test/integration/targets/python_requirements_facts/aliases @@ -1 +1 @@ -unsupported +shippable/posix/group2