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

Correct regex in is_keyid

The `rpm_key` module claims to take a key ID as an argument, however it fails if one is actually given:

    msg: Not a valid key DEADBEEF

The reason for this is the regular expression in the `RpmKey.is_keyid` method is incorrect; it will only match the literal string "0-9a-f" exactly 8 times, rather than exactly 8 characters in the set 0-9 or a-f.
This commit is contained in:
Dustin C. Hatch 2014-07-11 14:02:25 -05:00
parent db96344966
commit dc304e6488

View file

@ -156,7 +156,7 @@ class RpmKey:
def is_keyid(self, keystr):
"""Verifies if a key, as provided by the user is a keyid"""
return re.match('(0x)?(0-9a-f){8}', keystr, flags=re.IGNORECASE)
return re.match('(0x)?[0-9a-f]{8}', keystr, flags=re.IGNORECASE)
def execute_command(self, cmd):
if self.syslogging: