Do key validation only when key is provided
key_id is optional, the previous code didn't handle the case of key_id not specified
This commit is contained in:
parent
6dedb68bde
commit
a96f75c396
1 changed files with 6 additions and 5 deletions
|
@ -188,11 +188,12 @@ def main():
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
changed = False
|
changed = False
|
||||||
|
|
||||||
try:
|
if key_id:
|
||||||
_ = int(key_id, 16)
|
try:
|
||||||
key_id = key_id.lstrip('0x')
|
_ = int(key_id, 16)
|
||||||
except ValueError:
|
key_id = key_id.lstrip('0x')
|
||||||
module.fail_json("Invalid key_id")
|
except ValueError:
|
||||||
|
module.fail_json("Invalid key_id")
|
||||||
|
|
||||||
# FIXME: I think we have a common facility for this, if not, want
|
# FIXME: I think we have a common facility for this, if not, want
|
||||||
check_missing_binaries(module)
|
check_missing_binaries(module)
|
||||||
|
|
Loading…
Reference in a new issue