mirror of
https://gh.llkk.cc/https://github.com/WeblateOrg/scripts.git
synced 2025-10-03 15:01:00 +08:00
chore(deps): update pre-commit hook scop/pre-commit-shfmt to v3.12.0-1 (#307)
* chore(deps): update pre-commit hook scop/pre-commit-shfmt to v3.12.0-1 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
c2ca1f3e17
commit
64d215f99d
15 changed files with 384 additions and 384 deletions
|
@ -4,26 +4,26 @@ KEY="$(sed -n '/^env.KEY/ s/^env.KEY \(.*\)/\1/p' /etc/munin/plugin-conf.d/webla
|
|||
SERVER="$(sed -n '/^env.SERVER/ s/^env.SERVER \(.*\)/\1/p' /etc/munin/plugin-conf.d/weblate_servers)"
|
||||
|
||||
if [ -z "$SERVER" ]; then
|
||||
echo "Missing server configuration!"
|
||||
exit 1
|
||||
echo "Missing server configuration!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$KEY" ]; then
|
||||
if ! curl -f -s -H "Authorization: Token $KEY" "${SERVER}api/metrics/" -o /dev/null; then
|
||||
echo "Key not working, recreating"
|
||||
KEY=""
|
||||
fi
|
||||
if ! curl -f -s -H "Authorization: Token $KEY" "${SERVER}api/metrics/" -o /dev/null; then
|
||||
echo "Key not working, recreating"
|
||||
KEY=""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$KEY" ]; then
|
||||
|
||||
echo "Generating new key"
|
||||
if [ -f "/home/weblate/weblate/docker-compose.override.yml" ]; then
|
||||
cd /home/weblate/weblate || exit 1
|
||||
KEY="$(sudo -u weblate docker compose exec --user weblate weblate weblate shell --no-imports -c 'from weblate.auth.models import User; user = User.objects.get_or_create(username="monitor")[0]; print(user.auth_token.key)')"
|
||||
else
|
||||
KEY="$(sudo -u weblate /home/weblate/weblate-env/bin/weblate shell --no-imports -c 'from weblate.auth.models import User; user = User.objects.get_or_create(username="monitor")[0]; print(user.auth_token.key)')"
|
||||
fi
|
||||
echo "Generating new key"
|
||||
if [ -f "/home/weblate/weblate/docker-compose.override.yml" ]; then
|
||||
cd /home/weblate/weblate || exit 1
|
||||
KEY="$(sudo -u weblate docker compose exec --user weblate weblate weblate shell --no-imports -c 'from weblate.auth.models import User; user = User.objects.get_or_create(username="monitor")[0]; print(user.auth_token.key)')"
|
||||
else
|
||||
KEY="$(sudo -u weblate /home/weblate/weblate-env/bin/weblate shell --no-imports -c 'from weblate.auth.models import User; user = User.objects.get_or_create(username="monitor")[0]; print(user.auth_token.key)')"
|
||||
fi
|
||||
|
||||
sed -i "s/^env.KEY .*/env.KEY $KEY/" /etc/munin/plugin-conf.d/weblate_servers
|
||||
sed -i "s/^env.KEY .*/env.KEY $KEY/" /etc/munin/plugin-conf.d/weblate_servers
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue