mirror of
https://github.com/frappe/bench.git
synced 2025-01-24 15:38:25 +00:00
chore(deepsource): update docstrings for public functions
This commit is contained in:
parent
d51311b7f7
commit
af8f74db46
@ -12,6 +12,7 @@ from bench.utils import CommandFailedError, exec_cmd, fix_prod_setup_perms, get_
|
|||||||
|
|
||||||
|
|
||||||
def setup_production_prerequisites():
|
def setup_production_prerequisites():
|
||||||
|
"""Installs ansible, fail2banc, NGINX and supervisor"""
|
||||||
if not find_executable("ansible"):
|
if not find_executable("ansible"):
|
||||||
exec_cmd("sudo {0} -m pip install ansible".format(sys.executable))
|
exec_cmd("sudo {0} -m pip install ansible".format(sys.executable))
|
||||||
if not find_executable("fail2ban-client"):
|
if not find_executable("fail2ban-client"):
|
||||||
|
@ -14,6 +14,7 @@ from six.moves import configparser
|
|||||||
|
|
||||||
|
|
||||||
def generate_supervisor_config(bench_path, user=None, yes=False):
|
def generate_supervisor_config(bench_path, user=None, yes=False):
|
||||||
|
"""Generate supervisor config for respective bench path"""
|
||||||
if not user:
|
if not user:
|
||||||
user = getpass.getuser()
|
user = getpass.getuser()
|
||||||
|
|
||||||
@ -55,6 +56,7 @@ def generate_supervisor_config(bench_path, user=None, yes=False):
|
|||||||
|
|
||||||
|
|
||||||
def get_supervisord_conf():
|
def get_supervisord_conf():
|
||||||
|
"""Returns path of supervisord config from possible paths"""
|
||||||
possibilities = ("supervisord.conf", "etc/supervisord.conf", "/etc/supervisord.conf", "/etc/supervisor/supervisord.conf", "/etc/supervisord.conf")
|
possibilities = ("supervisord.conf", "etc/supervisord.conf", "/etc/supervisord.conf", "/etc/supervisor/supervisord.conf", "/etc/supervisord.conf")
|
||||||
|
|
||||||
for possibility in possibilities:
|
for possibility in possibilities:
|
||||||
|
@ -11,6 +11,7 @@ from bench.utils import exec_cmd, get_bench_name, get_cmd_output
|
|||||||
|
|
||||||
|
|
||||||
def is_sudoers_set():
|
def is_sudoers_set():
|
||||||
|
"""Check if bench sudoers is set"""
|
||||||
cmd = ["sudo", "-n", "bench"]
|
cmd = ["sudo", "-n", "bench"]
|
||||||
|
|
||||||
with open(os.devnull, "wb") as f:
|
with open(os.devnull, "wb") as f:
|
||||||
@ -28,6 +29,7 @@ def is_sudoers_set():
|
|||||||
|
|
||||||
|
|
||||||
def is_production_set(bench_path):
|
def is_production_set(bench_path):
|
||||||
|
"""Check if production is set for current bench"""
|
||||||
production_setup = False
|
production_setup = False
|
||||||
bench_name = get_bench_name(bench_path)
|
bench_name = get_bench_name(bench_path)
|
||||||
|
|
||||||
@ -47,6 +49,7 @@ def is_production_set(bench_path):
|
|||||||
|
|
||||||
|
|
||||||
def execute(bench_path):
|
def execute(bench_path):
|
||||||
|
"""This patch checks if bench sudoers is set and regenerate supervisor and sudoers files"""
|
||||||
user = get_config('.').get("frappe_user") or getpass.getuser()
|
user = get_config('.').get("frappe_user") or getpass.getuser()
|
||||||
|
|
||||||
if is_sudoers_set():
|
if is_sudoers_set():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user