https://qiita.com/fake-deli-ca/items/7fb2446a94e3c2b2477a
gitlabに付属しているmattermostで、以前は上記の記事通りにユーザ削除をやってたんだけど、1年ぶりくらいにやってみたら、こういうエラーが出た。
$ /opt/gitlab/embedded/bin/mattermost -config='/var/opt/gitlab/mattermost/config.json' --version
---------------------------------------------------------------------------------------------
DEPRECATED! All previous commands are now deprecated. Run: platform help to see the new ones.
---------------------------------------------------------------------------------------------
panic: runtime error: invalid memory address or nil pointer dereference
https://docs.mattermost.com/administration/command-line-tools.html#mattermost-3-6-and-later
どうも、この3.6以降のCLIじゃないと動かなくなったみたい。
Version
mattermost@dev:/opt/gitlab/embedded/bin$ ./mattermost --config='/var/opt/gitlab/mattermost/config.json' version
Version: 3.7.0
Build Number: 3.7.5
(中略)
Build Enterprise Ready: false
DB Version: 3.7.0
動作方法
途中までは変わらず。dockerの中に入るところも一緒。
[root]# docker exec -it dev_gitlab_1 bash
root@dev:/# su - mattermost
$ bash
mattermost@dev:~$
ここからの手順が違う。
あ、config.json
を設定するところは変わらないのと、mattermostアカウントじゃないとエラーになるところは今までと変わらず。
$ ./mattermost --config='/var/opt/gitlab/mattermost/config.json' user delete hogehoge@example.com
Have you performed a database backup? (YES/NO):
YES
Are you sure you want to delete the teams specified? All data will be permanently deleted? (YES/NO):
YES
[2020/10/12 10:38:39 UTC] [WARN] api.user.permanent_delete_user.attempting.warn%!(EXTRA string=hogehoge@example.com, string=j89mfnxdw7djifzy8m5ibg1m7c)
WARNが出るので若干不安になったが、うまく削除できれば、もう一度やり直すと登録なし、になる。
$ ./mattermost --config='/var/opt/gitlab/mattermost/config.json' user delete hogehoge@example.com
Have you performed a database backup? (YES/NO):
YES
Are you sure you want to delete the teams specified? All data will be permanently deleted? (YES/NO):
YES
Error: Unable to find user 'hogehoge@example.com'
Usage:
platform user delete [users] [flags]
Examples:
user delete user@example.com
Flags:
--confirm Confirm you really want to delete the user and a DB backup has been performed.
Global Flags:
-c, --config string Configuration file to use. (default "config.json")