Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

Commit 0c7fb34d authored by Rob Carleski's avatar Rob Carleski 🇮🇸
Browse files

Fixes for argument prompting

parent c4143a87
...@@ -218,21 +218,22 @@ def main(): ...@@ -218,21 +218,22 @@ def main():
default='' default=''
) )
args.owners = arg_prompt( args.owners = arg_prompt(
'(option 1) Full email addresses of owners, separated by spaces', '(option 1) Full email addresses of owners, separated by commas',
default='' default=''
).split(' ') ).split(',')
args.owners_file = arg_prompt( print(args.owners)
'(option 2) Full file path to a list of owners', if not args.owners[0]:
default=None args.owners_file = arg_prompt(
) '(option 2) Full file path to a list of owners'
)
args.members = arg_prompt( args.members = arg_prompt(
'(option 1) Full email addresses of members, separated by spaces', '(option 1) Full email addresses of members, separated by commas',
default='' default=''
).split(' ') ).split(',')
args.members_file = arg_prompt( if not args.members[0]:
'(option 2) The full file path to a list of members', args.members_file = arg_prompt(
default=None '(option 2) The full file path to a list of members'
) )
args.description = arg_prompt( args.description = arg_prompt(
'(optional) Description to assign to the group', '(optional) Description to assign to the group',
default='' default=''
......
...@@ -73,7 +73,7 @@ class Resource: ...@@ -73,7 +73,7 @@ class Resource:
cmd([ cmd([
self.config['google']['gam_command'], self.config['google']['gam_command'],
'calendar', 'calendar',
self.email, self.email.decode('utf-8'),
'add', 'add',
'owner', 'owner',
owner owner
...@@ -90,7 +90,7 @@ class Resource: ...@@ -90,7 +90,7 @@ class Resource:
cmd([ cmd([
self.config['google']['gam_command'], self.config['google']['gam_command'],
'calendar', 'calendar',
self.email, self.email.decode('utf-8'),
'delete', 'delete',
'user', 'user',
'domain' 'domain'
...@@ -98,7 +98,7 @@ class Resource: ...@@ -98,7 +98,7 @@ class Resource:
cmd([ cmd([
self.config['google']['gam_command'], self.config['google']['gam_command'],
'calendar', 'calendar',
self.email, self.email.decode('utf-8'),
'delete', 'delete',
'user', 'user',
'default' 'default'
...@@ -138,7 +138,7 @@ to this message and your incident will be automatically reopened.'''.format( ...@@ -138,7 +138,7 @@ to this message and your incident will be automatically reopened.'''.format(
self.resource_type, self.resource_type,
self.description, self.description,
','.join(self.owners), ','.join(self.owners),
self.email self.email.decode('utf-8')
) )
print( print(
......
...@@ -114,6 +114,7 @@ def main(): ...@@ -114,6 +114,7 @@ def main():
'Number of alias labels to create. [50]', 'Number of alias labels to create. [50]',
default=50 default=50
) )
args.total = int(args.total)
args.prefix = arg_prompt( args.prefix = arg_prompt(
'(optional) Prefix to assign to labels', '(optional) Prefix to assign to labels',
default=None default=None
......
...@@ -68,9 +68,16 @@ class SharedAccount(): ...@@ -68,9 +68,16 @@ class SharedAccount():
self.config['mcommunity']['secret'] self.config['mcommunity']['secret']
) )
self.mcomm_group = client.group(self.groupname) self.mcomm_group = client.group(self.groupname)
assert self.mcomm_group.dn
except mcommunity.core.MCommError as e: except mcommunity.core.MCommError as e:
self.logger.error(e, extra={'entity': self.account}) self.logger.error(e, extra={'entity': self.account})
exit(2) exit(2)
except AssertionError:
self.logger.error(
'Unable to find matching group in MCommunity',
extra={'entity': self.account}
)
exit(2)
def set_kerberos_password(self): def set_kerberos_password(self):
try: try:
......
...@@ -27,7 +27,7 @@ class Sifter: ...@@ -27,7 +27,7 @@ class Sifter:
config['google']['gam_command'], config['google']['gam_command'],
'whatis', 'whatis',
self.account self.account
], stderr=devnull) ])
except CalledProcessError as e: except CalledProcessError as e:
self.logger.error(e.output, extra={'entity': self.account}) self.logger.error(e.output, extra={'entity': self.account})
exit(2) exit(2)
...@@ -238,7 +238,7 @@ class Sifter: ...@@ -238,7 +238,7 @@ class Sifter:
self.config['google']['gam_command'], self.config['google']['gam_command'],
'whatis', 'whatis',
upload_user upload_user
], stderr=devnull) ])
except CalledProcessError as e: except CalledProcessError as e:
self.logger.warning(e.output, extra={'entity': self.account}) self.logger.warning(e.output, extra={'entity': self.account})
upload_user = self.config['google']['admin_account'] upload_user = self.config['google']['admin_account']
...@@ -363,9 +363,9 @@ def main(): ...@@ -363,9 +363,9 @@ def main():
default='root' default='root'
) )
args.omit_foders = arg_prompt( args.omit_foders = arg_prompt(
'(optional) Omit folders with the following names', '(optional) Omit these folders (comma-delimited)',
default='' default=''
).split(' ') ).split(',')
args.destination_account = arg_prompt( args.destination_account = arg_prompt(
'(optional) Upload reports to this account. (defaults to you)', '(optional) Upload reports to this account. (defaults to you)',
default=False default=False
......
...@@ -112,7 +112,7 @@ def main(): ...@@ -112,7 +112,7 @@ def main():
args.omit_labels = arg_prompt( args.omit_labels = arg_prompt(
'(optional) Omit labels with the following names', '(optional) Omit labels with the following names',
default='' default=''
).split(' ') ).split(',')
# Argument sanity check # Argument sanity check
_required = ['account'] _required = ['account']
......
...@@ -68,7 +68,7 @@ class Mover: ...@@ -68,7 +68,7 @@ class Mover:
self.owner, self.owner,
'role', 'role',
'reader' 'reader'
], stderr=devnull) ])
cmd([ cmd([
self.config['google']['gam_command'], self.config['google']['gam_command'],
'user', 'user',
...@@ -79,7 +79,7 @@ class Mover: ...@@ -79,7 +79,7 @@ class Mover:
self.owner, self.owner,
'role', 'role',
'owner' 'owner'
], stderr=devnull) ])
except CalledProcessError as e: except CalledProcessError as e:
self.logger.warning( self.logger.warning(
e.output, e.output,
...@@ -100,7 +100,7 @@ class Mover: ...@@ -100,7 +100,7 @@ class Mover:
'drivefileacl', 'drivefileacl',
item['id'], item['id'],
item['owner'] item['owner']
], stderr=devnull) ])
except CalledProcessError as e: except CalledProcessError as e:
self.logger.warning(e.output, extra={'entity': item['owner']}) self.logger.warning(e.output, extra={'entity': item['owner']})
...@@ -145,7 +145,7 @@ def main(): ...@@ -145,7 +145,7 @@ def main():
# Argument prompt fallback # Argument prompt fallback
if not args.owner: if not args.owner:
args.owner = arg_prompt( args.owner = arg_prompt(
'Uniqname of new file/folder owner:' 'Uniqname of new file/folder owner'
) )
args.id_file = arg_prompt( args.id_file = arg_prompt(
'Full path to ID file generated from google-sift-drive' 'Full path to ID file generated from google-sift-drive'
......
...@@ -310,13 +310,13 @@ def main(): ...@@ -310,13 +310,13 @@ def main():
'Email address associated with destination mailbox' 'Email address associated with destination mailbox'
) )
args.labels = arg_prompt( args.labels = arg_prompt(
'(option 1) Labels to transfer, separated by spaces', '(option 1) Labels to transfer, separated by commas',
default='' default=''
) ).split(',')
args.label_file = arg_prompt( if not args.labels[0]:
'(option 2) The full path to a list of user labels to transfer', args.label_file = arg_prompt(
default='' '(option 2) Full path to a list of user labels to transfer'
) )
# Argument sanity check # Argument sanity check
_required = [ _required = [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment