1
0
mirror of https://github.com/laurivosandi/certidude synced 2024-12-22 08:15:18 +00:00

tests: Create certidude user in advance

This commit is contained in:
Lauri Võsandi 2017-05-01 17:56:10 +00:00
parent f9eaa94230
commit e0eb3ee471
2 changed files with 4 additions and 2 deletions

View File

@ -17,6 +17,7 @@ install:
script:
- sudo useradd adminbot -G sudo -p '$1$PBkf5waA$n9EV6WJ7PS6lyGWkgeTPf1'
- sudo useradd userbot -G users -p '$1$PBkf5waA$n9EV6WJ7PS6lyGWkgeTPf1'
- sudo adduser --system --no-create-home --group certidude
- sudo py.test --cov-report xml --cov=certidude tests/
cache:
directories:

View File

@ -828,6 +828,7 @@ def certidude_setup_authority(username, kerberos_keytab, nginx_config, country,
if os.getuid() == 0:
try:
pwd.getpwnam("certidude")
click.echo("User 'certidude' already exists")
except KeyError:
cmd = "adduser", "--system", "--no-create-home", "--group", "certidude"
if subprocess.call(cmd):
@ -871,8 +872,8 @@ def certidude_setup_authority(username, kerberos_keytab, nginx_config, country,
port = "80"
else:
port = "8080"
click.echo("Generating: %s" % nginx_config.name)
nginx_config.write(env.get_template("server/nginx.conf").render(vars()))
click.echo("Generated: %s" % nginx_config.name)
if not os.path.exists("/etc/nginx/sites-enabled/certidude.conf"):
os.symlink("../sites-available/certidude.conf", "/etc/nginx/sites-enabled/certidude.conf")
click.echo("Symlinked %s -> /etc/nginx/sites-enabled/" % nginx_config.name)
@ -889,7 +890,7 @@ def certidude_setup_authority(username, kerberos_keytab, nginx_config, country,
fh.write(env.get_template("server/systemd.service").render(vars()))
click.echo("File /etc/systemd/system/certidude.service created")
else:
NotImplemented # No systemd
click.echo("Not systemd based OS, don't know how to set up initscripts")
_, _, uid, gid, gecos, root, shell = pwd.getpwnam("certidude")
os.setgid(gid)