Skip to content

Commit

Permalink
deploy: Further improvements regarding db initialization
Browse files Browse the repository at this point in the history
- Proper chain between init_user and zeus log file tasks
- Prevent setting of user groups for unsaved user entry
- Fix for duplicate variable declaration in dev mode
  • Loading branch information
vinilios committed Sep 4, 2018
1 parent 729528f commit 51ad11c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions deploy/grnet-zeus/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
owner => 'www-data',
group => 'celery',
recurse => true,
ignore => '.git',
require => Package['celeryd']
}

Expand Down Expand Up @@ -176,9 +177,10 @@
require => File['zeus_settings']
}

$collectcmd = "python manage.py collectstatic --noinput"
if $dev {
$collectcmd = "python manage.py collectstatic --noinput -l"
} else {
$collectcmd = "python manage.py collectstatic --noinput"
}

exec {'zeus_collectstatic':
Expand Down Expand Up @@ -250,9 +252,7 @@
cwd => $appdir,
path => ["/usr/bin", "/usr/sbin"],
require => [File['zeus_settings'], Exec['zeus_migrations']],
creates => '/srv/zeus-data/zeus.log',
user => 'www-data',
group => 'celery'
notify => File['zeus_zeus_log']
}

apache::listen { $port: }
Expand Down
4 changes: 3 additions & 1 deletion deploy/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ def main(institution_name, username, password):
user.management_p = True
user.institution = inst
user.ecounting_account = False
user.user_groups = UserGroup.objects.all()
user.info = {
"name": username,
"password": make_password(password)
}
if not user.pk:
user.save()
user.user_groups = UserGroup.objects.all()
user.save()

main(*sys.argv[1:])

0 comments on commit 51ad11c

Please sign in to comment.