mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fixed FreeBSD ports install issue
This commit is contained in:
parent
375edbd087
commit
08370b3caf
1 changed files with 5 additions and 6 deletions
|
@ -99,15 +99,14 @@ def query_package(module, name):
|
||||||
def matching_packages(module, name):
|
def matching_packages(module, name):
|
||||||
|
|
||||||
ports_glob_path = module.get_bin_path('ports_glob', True)
|
ports_glob_path = module.get_bin_path('ports_glob', True)
|
||||||
rc, out, err = module.run_command("%s %s | wc" % (ports_glob_path, name))
|
rc, out, err = module.run_command("%s %s" % (ports_glob_path, name))
|
||||||
parts = out.split()
|
#counts the numer of packages found
|
||||||
occurrences = int(parts[0])
|
occurrences = out.count('\n')
|
||||||
if occurrences == 0:
|
if occurrences == 0:
|
||||||
name_without_digits = re.sub('[0-9]', '', name)
|
name_without_digits = re.sub('[0-9]', '', name)
|
||||||
if name != name_without_digits:
|
if name != name_without_digits:
|
||||||
rc, out, err = module.run_command("%s %s | wc" % (ports_glob_path, name_without_digits))
|
rc, out, err = module.run_command("%s %s" % (ports_glob_path, name_without_digits))
|
||||||
parts = out.split()
|
occurrences = out.count('\n')
|
||||||
occurrences = int(parts[0])
|
|
||||||
return occurrences
|
return occurrences
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue