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

Fixed for collab_create_shared

* Only compare group owners when group data is populated
* Have the script die if the mcommunity group cannot be
* created/manipulated
* Warn on failure to add new owners/error removing api controller
* Prevent script from removing api controller as owner if no new owners
* are added to the group
parent 047cd238
...@@ -217,7 +217,7 @@ https://documentation.its.umich.edu/node/339/ ...@@ -217,7 +217,7 @@ https://documentation.its.umich.edu/node/339/
except Exception as e: except Exception as e:
self.logger.info(e, extra={'entity': self.account}) self.logger.info(e, extra={'entity': self.account})
if hasattr(client, 'group_data'): if hasattr(client, 'group_data') and client.group_data:
self.logger.info( self.logger.info(
'Found associated MCommunity group', 'Found associated MCommunity group',
extra={'entity': self.account} extra={'entity': self.account}
...@@ -276,6 +276,13 @@ https://documentation.its.umich.edu/node/339/ ...@@ -276,6 +276,13 @@ https://documentation.its.umich.edu/node/339/
self.logger.info(e, extra={'entity': self.account}) self.logger.info(e, extra={'entity': self.account})
exit(2) exit(2)
if not client.group_data:
self.logger.error(
'Unable to fetch shared account Mcommunity group.',
extra={'entity': self.account}
)
exit(2)
try: try:
self.logger.info( self.logger.info(
'Adding Mcommunity group alias', 'Adding Mcommunity group alias',
...@@ -301,10 +308,17 @@ https://documentation.its.umich.edu/node/339/ ...@@ -301,10 +308,17 @@ https://documentation.its.umich.edu/node/339/
extra={'entity': self.account} extra={'entity': self.account}
) )
client.add_group_owners(self.owners) client.add_group_owners(self.owners)
client.remove_group_owners( try:
self.config['mcommunity']['api_control_group'] client.update_group_owners()
) client.remove_group_owners(
client.update_group_owners() self.config['mcommunity']['api_control_group']
)
client.update_group_owners()
except Exception:
self.logger.warning(
'Error modifying group ownership. Correct manually.',
extra={'entity': self.account}
)
except Exception as e: except Exception as e:
self.logger.warning(e, extra={'entity': self.account}) self.logger.warning(e, extra={'entity': self.account})
......
Supports Markdown
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