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 e4b36cbd authored by Rob Carleski's avatar Rob Carleski 🇮🇸
Browse files

Add groupname/username for reset_shared

parent 86462fe5
......@@ -22,6 +22,8 @@ class SharedAccount():
self.box_exists = False
self.google_exists = False
self.logger = logging.getLogger(__name__)
self.groupname = re.sub(r'[\_\.]', ' ', self.account.strip()).lower()
self.username = re.sub(r'[\_\s]', '.', self.account.strip()).lower()
def check_box(self):
try:
......@@ -29,10 +31,10 @@ class SharedAccount():
self.config['box']['auth_file']
)
boxClient = boxsdk.Client(auth)
boxUsers = boxClient.users(filter_term=self.account)
boxUsers = boxClient.users(filter_term=self.username)
for _ in boxUsers:
login = _['login'].split('@')[0]
if self.account.lower() == login.lower():
if self.username.lower() == login.lower():
self.box_exists = True
break
return False
......@@ -46,7 +48,7 @@ class SharedAccount():
output = cmd([
self.config['google']['gam_command'],
'whatis',
self.account,
self.username,
'userview'
], stderr=STDOUT
)
......@@ -62,7 +64,7 @@ class SharedAccount():
self.config['mcommunity']['client_id'],
self.config['mcommunity']['secret']
)
self.mcomm_group = client.group(self.account)
self.mcomm_group = client.group(self.groupname)
except mcommunity.core.MCommError as e:
self.logger.error(e, extra={'entity': self.account})
exit(2)
......@@ -78,14 +80,14 @@ class SharedAccount():
self.config['kerberos']['keytab']
)
principal = '{}@{}'.format(
self.account,
self.username,
self.config['kerberos']['realm'].upper()
)
princ = kadm.getprinc(principal)
if not princ:
self.logger.warning(
'Kerberos principal does not exist. Creating.',
extra={'entity': self.account}
extra={'entity': self.username}
)
kadm.addprinc(principal, self.password)
else:
......@@ -103,7 +105,7 @@ class SharedAccount():
self.config['google']['gam_command'],
'update',
'user',
self.account,
self.username,
'password',
self.password
], stderr=STDOUT
......
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