This should fix the problems with the automatic user creation

This commit is contained in:
Alexander Trost
2015-10-19 18:43:20 +02:00
parent b617f0fab2
commit cd75ef7033
4 changed files with 17 additions and 20 deletions

View File

@@ -0,0 +1,12 @@
#!/bin/bash
/home/zulip/deployments/current/manage.py create_user --this-user-has-accepted-the-tos "$ZULIP_USER_EMAIL" "$ZULIP_USER_FULLNAME" --domain "$ZULIP_USER_DOMAIN" || :
/home/zulip/deployments/current/manage.py knight "$ZULIP_USER_EMAIL" -f || :
/home/zulip/deployments/current/manage.py shell <<EOF
from zerver.decorator import get_user_profile_by_email
User = get_user_profile_by_email('atrost@zerbytes.net')
User.set_password('$ZULIP_USER_PASSWORD')
User.save()
EOF
rm -rf /etc/supervisor/conf.d/zulip_postsetup.conf
exit 0

View File

@@ -1,5 +1,6 @@
[program:zulip-postsetup]
command = bash -c "/usr/local/bin/zulipCreateUser.sh"
[program:zulip-postsetup-create_user]
command = bash -c "sleep 8;/opt/setupZulipUser.sh"
user=zulip
stdout_events_enabled=true
stderr_events_enabled=true
autorestart = false

View File

@@ -1,16 +0,0 @@
#!/bin/bash
sleep 5
/home/zulip/deployments/current/manage.py create_user --this-user-has-accepted-the-tos "$ZULIP_USER_EMAIL" "$ZULIP_USER_FULLNAME" --domain "$ZULIP_USER_DOMAIN" || :
/home/zulip/deployments/current/manage.py knight "$ZULIP_USER_EMAIL" -f || :
exec expect <<EOF
spawn su zulip -c "/home/zulip/deployments/current/manage.py changepassword $ZULIP_USER_EMAIL"
expect "Password: "
send "$ZULIP_USER_PASSWORD"
send "\n"
expect "Password (again): "
send "$ZULIP_USER_PASSWORD"
send "\n"
send "\n"
exit
EOF

View File

@@ -44,11 +44,11 @@ class zulip::voyager {
mode => 644,
source => "puppet:///modules/zulip/supervisor/conf.d/zulip_postsetup.conf",
}
file { "/usr/local/bin/zulipPostSetup.sh":
file { "/opt/setupZulipUser.sh":
ensure => file,
owner => "root",
group => "root",
mode => 755,
source => "puppet:///modules/zulip/zulipPostSetup.sh",
source => "puppet:///modules/zulip/setupZulipUser.sh",
}
}