Add 'Automatic' ServiceKeyApprovalType
This commit is contained in:
parent
c766727d1d
commit
2242c6773d
5 changed files with 13 additions and 10 deletions
|
@ -6,7 +6,7 @@ from timeparse import ParseDatetime
|
|||
|
||||
import argparse
|
||||
|
||||
def generate_key(service, name, approver=None, expiration_date=None, notes=None):
|
||||
def generate_key(service, name, expiration_date=None, notes=None):
|
||||
metadata = {
|
||||
'created_by': 'CLI tool',
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ def generate_key(service, name, approver=None, expiration_date=None, notes=None)
|
|||
metadata=metadata,
|
||||
name=name)
|
||||
# Auto-approve the service key.
|
||||
model.service_keys.approve_service_key(key.kid, approver, ServiceKeyApprovalType.SUPERUSER,
|
||||
model.service_keys.approve_service_key(key.kid, None, ServiceKeyApprovalType.AUTOMATIC,
|
||||
notes=notes or '')
|
||||
|
||||
# Log the creation and auto-approval of the service key.
|
||||
|
@ -36,7 +36,6 @@ def generate_key(service, name, approver=None, expiration_date=None, notes=None)
|
|||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='Generates a preshared key')
|
||||
parser.add_argument('approver', help='Quay username of the user approving this key')
|
||||
parser.add_argument('service', help='The service name for which the key is being generated')
|
||||
parser.add_argument('name', help='The friendly name for the key')
|
||||
parser.add_argument('--expiration', help='The optional expiration date/time for the key',
|
||||
|
|
Reference in a new issue