Raise exception if --pubkeys not given while delegating

Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
This commit is contained in:
Vladimir Diaz 2018-03-16 15:44:54 -04:00
parent e6dcb27efc
commit 5ff7a5ea84
No known key found for this signature in database
GPG key ID: 5DEE9B97B0E2289A

View file

@ -145,12 +145,17 @@ def process_arguments(parsed_arguments):
def delegate(parsed_arguments):
if not parsed_arguments.delegatee:
raise tuf.exceptions.Error('--delegatee must be set to perform a delegation.')
raise tuf.exceptions.Error(
'--delegatee must be set to perform the delegation.')
if parsed_arguments.delegatee in ['root', 'snapshot', 'timestamp', 'targets']:
raise tuf.exceptions.Error(
'Cannot delegate to the top-level role: ' + repr(parsed_arguments.delegatee))
if not parsed_arguments.pubkeys:
raise tuf.exceptions.Error(
'--pubkeys must be set to perform the delegation.')
public_keys = []
for public_key in parsed_arguments.pubkeys:
# In the future, any type of key can be imported...