Merge pull request #645 from vladimir-v-diaz/require_pubkeys_when_delegating

Raise exception if --pubkeys not given while delegating
This commit is contained in:
Vladimir Diaz 2018-03-16 16:06:31 -04:00 committed by GitHub
commit e0aacb29b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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...