python: lib mattermost
This commit is contained in:
@@ -2,8 +2,9 @@ import subprocess
|
||||
|
||||
from .config import getDockersConfig, getSecretConfig
|
||||
|
||||
mattermost_user = getSecretConfig("mattermostServ", "MM_ADMIN_USER")
|
||||
mattermost_pass = getSecretConfig("mattermostServ", "MM_ADMIN_PASSWORD")
|
||||
mattermost_user = getSecretConfig("mattermostAdmin", "mattermost_user")
|
||||
mattermost_pass = getSecretConfig("mattermostAdmin", "mattermost_pass")
|
||||
# mattermost_token = getSecretConfig("mattermostAdmin", "mattermost_token")
|
||||
mattermost_url = f"https://{getDockersConfig('matterHost')}.{getDockersConfig('domain')}"
|
||||
mmctl = "docker exec -i mattermostServ bin/mmctl"
|
||||
|
||||
@@ -23,6 +24,8 @@ class Mattermost:
|
||||
def authenticate(self):
|
||||
# Authentification sur MM
|
||||
cmd = f"{mmctl} auth login {mattermost_url} --name local-server --username {mattermost_user} --password {mattermost_pass}"
|
||||
# ou (si ça casse le token ?)
|
||||
# cmd = f"{mmctl} auth login {mattermost_url} --name local-server --access-token {mattermost_token}"
|
||||
subprocess.run(cmd, shell=True, stderr=subprocess.STDOUT, check=True)
|
||||
|
||||
|
||||
@@ -131,4 +134,3 @@ class Mattermost:
|
||||
cmd = f"{mmctl} team delete {equipe} --confirm"
|
||||
output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
|
||||
return output.decode()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user