Fixed bugs to create servers

This commit is contained in:
absurdo 2024-03-13 20:42:51 +01:00
parent 92ae8e7d36
commit 44ffe2da55
5 changed files with 144 additions and 8 deletions

View file

@ -13,6 +13,7 @@ import pwd
import distro
import subprocess
import pwd
import grp
php_version={'php74': 'php7.4', 'php80': 'php8.0', 'php81': 'php8.1', 'php82': 'php8.2'}
@ -397,7 +398,19 @@ def manage():
if not ret_user:
print("User %s exists, used for the new site" % args.user)
#Need add to group apache if not. Need for red hat and derivatives.
g=grp.getgrnam('apache')
#grp.struct_group(gr_name='apache', gr_passwd='x', gr_gid=48, gr_mem=['absurdo'])
if args.user not in g.gr_mem:
if call("sudo usermod -a -G %s %s" % (apache_group, args.user), shell=True) > 0:
print('Error, cannot add group to user')
exit(1)
else:
print('Added user to apache group')
else: