getlino.utils

Some utilities for getlino.

Functions

default_db_engine()

grpexists(name)

Check whether the user group with the given name exists.

has_usergroup(usergroup)

ifroot([true, false])

perm2text(value)

Convert a permission value given as integer returned by os.stat() to an "rwx" like text as used by ls -l.

resolve_db_engine(db_engine)

resolve_web_server(web_server)

which_certbot()

Classes

Apache()

DbEngine()

Installer([batch])

Volatile object used by getlino.configure and getlino.startsite.

MySQL()

Nginx()

PostgreSQL()

SQLite()

WebServer()

getlino.utils.grpexists(name)

Check whether the user group with the given name exists.

getlino.utils.perm2text(value)

Convert a permission value given as integer returned by os.stat() to an “rwx” like text as used by ls -l.

Inspired from comment by hack-tramp (Jul 6, 2020) on https://gist.github.com/beugley/47b4812df0837fc90e783347faee2432

class getlino.utils.Installer(batch=False)

Bases: object

Volatile object used by getlino.configure and getlino.startsite.

check_overwrite(pth)

If pth (directory or file) exists, remove it after asking for confirmation. Return False if it exists and user doesn’t confirm.

yes_or_no(msg, yes='yY', no='nN', default=True)

Ask for confirmation without accepting a mere RETURN.

runcmd(*cmds, **kw)

Run the specified command(s) in a subprocess.

Stop when Ctrl-C. If the subprocess has non-zero return code, we simply stop. We don’t use check=True because this would add another useless traceback. The subprocess is responsible for reporting the reason of the error.

runcmd_sudo(*cmds, **kwargs)

Run the specified command(s) in a subprocess, prefixing each with sudo if needed.

run_in_env(env, cmd)

env is the path of the virtualenv

write_file(pth, content)

Write the given content to the named file pth.

make_file_executable(file_path)

Make a file executable

jinja_write(pth, tplname=None, **context)

pth : the full path of the file to generate. tplname : name of the template file to render. If tplname is not specified, use the tail of the output file.