1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

slackpkg: fix matching some special cases in package names. (#505)

* slackpkg: fix matching some special cases in package names.

* Add chagelog/fragments file

* Update changelogs/fragments/505-slackpkg_fix_matching_some_special_cases_in_package_names.yml

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
This commit is contained in:
majekw 2020-06-17 09:38:30 +02:00 committed by GitHub
parent a3953106e6
commit 736f2ecac0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- slackpkg - fix matching some special cases in package names (https://github.com/ansible-collections/community.general/pull/505).

View file

@ -72,7 +72,10 @@ def query_package(module, slackpkg_path, name):
import re import re
machine = platform.machine() machine = platform.machine()
pattern = re.compile('^%s-[^-]+-(%s|noarch)-[^-]+$' % (re.escape(name), re.escape(machine))) # Exception for kernel-headers package on x86_64
if name == 'kernel-headers' and machine == 'x86_64':
machine = 'x86'
pattern = re.compile('^%s-[^-]+-(%s|noarch|fw)-[^-]+$' % (re.escape(name), re.escape(machine)))
packages = [f for f in os.listdir('/var/log/packages') if pattern.match(f)] packages = [f for f in os.listdir('/var/log/packages') if pattern.match(f)]
if len(packages) > 0: if len(packages) > 0: