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 @@ ...@@ -217,7 +217,7 @@
except Exception as e: except Exception as e:, extra={'entity': self.account}), extra={'entity': self.account})
if hasattr(client, 'group_data'): if hasattr(client, 'group_data') and client.group_data:
'Found associated MCommunity group', 'Found associated MCommunity group',
extra={'entity': self.account} extra={'entity': self.account}
...@@ -276,6 +276,13 @@ ...@@ -276,6 +276,13 @@, extra={'entity': self.account}), extra={'entity': self.account})
exit(2) exit(2)
if not client.group_data:
'Unable to fetch shared account Mcommunity group.',
extra={'entity': self.account}
try: try:
'Adding Mcommunity group alias', 'Adding Mcommunity group alias',
...@@ -301,10 +308,17 @@ ...@@ -301,10 +308,17 @@
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']
except Exception:
'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