diff --git a/packaging/apt_key b/packaging/apt_key index 48c3873eb31..764eed6b8ee 100644 --- a/packaging/apt_key +++ b/packaging/apt_key @@ -191,7 +191,8 @@ def main(): if key_id: try: _ = int(key_id, 16) - key_id = key_id.lstrip('0x') + if key_id.startswith('0x'): + key_id = key_id[2:] except ValueError: module.fail_json("Invalid key_id")