Skip to content

Commit

Permalink
Merge pull request #2 from mnme/improved_check_versions
Browse files Browse the repository at this point in the history
Better sanity check and support for libgcrypt version suffix
  • Loading branch information
netson committed Mar 2, 2021
2 parents d6ba98b + f982013 commit 435f8e6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gpg_key.py
Expand Up @@ -1000,15 +1000,15 @@ def check_versions(self):
match_gpg = re.search(regex_gpg, lines[0])

# sanity check
if re.compile(regex_gpg).groups < 1:
if match_gpg is None or match_gpg.group(1) is None:
self.module.fail_json(msg="could not find a valid gpg version number in string [{}]".format(lines[0]))

# find libgcrypt version
regex_libgcrypt = r"libgcrypt\s+(\d+\.\d+\.?\d*)$"
regex_libgcrypt = r"libgcrypt\s+(\d+\.\d+\.?\d*)"
match_libgcrypt = re.match(regex_libgcrypt, lines[1])

# sanity check
if re.compile(regex_libgcrypt).groups < 1:
if match_libgcrypt is None or match_libgcrypt.group(1) is None:
self.module.fail_json(msg="could not find a valid libgcrypt version number in string [{}]".format(lines[1]))

# check versions
Expand Down

0 comments on commit 435f8e6

Please sign in to comment.