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

Fixes for argument prompting

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