How can I remove Teams from Gitlab Mattermost

I have about 3 or 4 test teams on out instance named test1, test2, TEST2. So we decided to keep Mattermost for good. Is there any easy way to remove those test groups?

Thanks
Christopher

http://forum.mattermost.com/t/how-can-i-delete-teams/220/2

For Mattermost v1.2.1 thereā€™s not a recommended way to remove teams from the database, and itā€™s highly recommended nothing in the database be changed.

An updated tool for System Admins to delete teams, channels and users from the database will be coming in the December release (Mattermost v1.3). The new functionality has already been merged to master.

1 Like

is there a way I can add someone to a team as an admin? There was some sort of bug during team creation for 4 teams on my instance, whereby it didnā€™t complete the process. The end result is that I have teams with 0 membersā€¦ not even an admin, and as such, have no way to add people to those teams.

Our teams here where I work have names, and so the team leads are creating teams using their team namesā€¦ and now those 4 teams donā€™t have a home, and we donā€™t want to create false team names for programmatic reasons.

Any suggestions?

mattermost.go -create_user -team_name="teamname" -email="you@example.com" -password="jimmers"
mattermost -assign_role -team_name="teamname" -email="you@example.com" -role="admin"

If the user.email == team.owner and itā€™s the first user created in the team then it will get the ā€œadminā€ by default.

or if want to make a system admin

mattermost -assign_role -team_name="teamname" -email="you@example.com" -role="system_admin"

I found that platform command is available as ā€˜mattermostā€™ in GitLab integrated version but the use of a command gives an error:

/opt/gitlab/embedded/bin/mattermost -permanent_delete_team -team_name="test2" -email="myemai@domain.org" panic: Error opening config file=config.json, err=open config.json: no such file or directory
goroutine 1 [running]:
github.com/mattermost/platform/utils.LoadConfig(0xc26f50, 0xb)
/go/src/github.com/mattermost/platform/utils/config.go:139 +0x16a
main.main()
/go/src/github.com/mattermost/platform/mattermost.go:54 +0x43
goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1696 +0x1
goroutine 20 [syscall]:
os/signal.loop()
/usr/local/go/src/os/signal/signal_unix.go:22 +0x18
   created by os/signal.init.1
/usr/local/go/src/os/signal/signal_unix.go:28 +0x37
goroutine 21 [chan receive]:
  code.google.com/p/log4go.ConsoleLogWriter.run(0xc820060120, 0x7f73b35911c0, 0xc82006c008)
    /go/src/github.com/mattermost/platform/Godeps/_workspace/src/code.google.com/p/log4go/termlog.go:27 +0x80
created by code.google.com/p/log4go.NewConsoleLogWriter
    /go/src/github.com/mattermost/platform/Godeps/_workspace/src/code.google.com/p/log4go/termlog.go:19 +0x6e

Any suggestions how should it be used?

K.

I fund the configuration file and proper user to user the tool. Unfortunately it does not work. Teams are where ther were before using it.

+1 for an admin console option to delete teams.:slight_smile:

1 Like

The command line tool had a bug introduced when localization was added in 2.0, it should be fixed in Mattermost 2.1 coming out tomorrow,

Feature ideas highly welcome for other options

I have now tried with version 2.1 but I do get an error panic: no language found in "config.json" What does that mean and how can I fix that?

The stack trace looks like this:

goroutine 1 [running]:
panic(0xc26280, 0xc820107650)
	/usr/local/go/src/runtime/panic.go:464 +0x3e6
github.com/nicksnyder/go-i18n/i18n/bundle.(*Bundle).MustLoadTranslationFile(0xc820011be0, 0xc820107600, 0xd)
	/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/nicksnyder/go-i18n/i18n/bundle/bundle.go:41 +0x77
github.com/nicksnyder/go-i18n/i18n.MustLoadTranslationFile(0xc820107600, 0xd)
	/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/nicksnyder/go-i18n/i18n/i18n.go:92 +0x37
github.com/mattermost/platform/utils.InitTranslations()
	/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/utils/i18n.go:25 +0x2c5
main.main()
	/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/mattermost.go:54 +0x2c

look into [Found workaround]CLI tool still crashing and throwing errors in 2.1.0

did you load the right en.json in the current directory?
did you su or sudo to mattermost?

Yes, I used sudo.

There is no en.json file but my problem starts earlier I guess: there is no language defined and therefore it doesnā€™t even look for a en.json file.

So: how do I define the language in the config.json? And when I did, where do I find the en.json file it is looking for?

I donā€™t think so. The code to blame is found somewhere starting at line 22 in utils/i18n.go and tells that the language is has not to be defined in config.json because all language files from the translations directory, which is incidentally now always the current directory :unamused: , are used. Unfortunately all *.json files residing there are loaded, even the files which arenā€™t language files like config.json and the i18n library gets mad about that.

The message no language found in "config.json" does not mean that a language definition is missing in mattermostā€™s config.json file but that the config.json found in the translations files directory isnā€™t a translation file at all

tl;dr: The en.json must be the only .json file in your current directory while you are running the mattermost cli command

That makes sense, thanks for that explanation. So the error message is a bit misleading but I can see where this is coming from.

Now Iā€™m going to /opt/gitlab/embedded/service/mattermost/i18n and call sudo /opt/gitlab/embedded/bin/mattermost -version -config="/var/opt/gitlab/mattermost/config.json" getting another error:

[13:25:54 CET 2016/03/24] [INFO] (github.com/mattermost/platform/utils.GetTranslationsBySystemLocale:52) Loaded system translations for 'en' from '/opt/gitlab/embedded/service/mattermost/i18n/en.json'
[2016/03/24 13:25:54 CET] [CRIT] Failed to ping db err:pq: Peer authentication failed for user "gitlab_mattermost"
panic: Failed to open sql connection pq: Peer authentication failed for user "gitlab_mattermost"

goroutine 1 [running]:
panic(0xb2e0c0, 0xc820431c60)
	/usr/local/go/src/runtime/panic.go:464 +0x3e6
github.com/mattermost/platform/store.setupConnection(0xd40f40, 0x6, 0xc820430bf0, 0x8, 0xc820060ae0, 0x5d, 0xa, 0xa, 0x419600, 0x10)
	/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/store/sql_store.go:169 +0x894
github.com/mattermost/platform/store.NewSqlStore(0x0, 0x0)
	/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/store/sql_store.go:61 +0x122
github.com/mattermost/platform/api.NewServer()
	/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/api/server.go:35 +0xe8
main.main()
	/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/mattermost.go:67 +0x756

wrong sudo, you have to be user mattermost while running mattermost

This is great, thank you so much for your patient support @BlueAnanas

For the record, here is the working command:

sudo -u mattermost /opt/gitlab/embedded/bin/mattermost -config="/var/opt/gitlab/mattermost/config.json" -permanent_delete_team=true -team_name="38fxueu1t3fobcdsyqk5hig49c"

and then replying with YES (all uppercase) to the two questions.