2
0
mirror of https://github.com/frappe/bench.git synced 2025-02-03 19:38:24 +00:00

fix sudoers, add user argument

This commit is contained in:
Pratik Vyas 2014-09-03 12:05:23 +05:30
parent c989a974b5
commit a509d339cf
2 changed files with 5 additions and 4 deletions

View File

@ -157,9 +157,10 @@ def setup():
pass pass
@click.command('sudoers') @click.command('sudoers')
def setup_sudoers(): @click.argument('user')
def setup_sudoers(user):
"Add commands to sudoers list for execution without password" "Add commands to sudoers list for execution without password"
_setup_sudoers() _setup_sudoers(user)
@click.command('nginx') @click.command('nginx')
def setup_nginx(): def setup_nginx():

View File

@ -122,10 +122,10 @@ def update_bench():
cwd = os.path.dirname(os.path.abspath(__file__)) cwd = os.path.dirname(os.path.abspath(__file__))
exec_cmd("git pull", cwd=cwd) exec_cmd("git pull", cwd=cwd)
def setup_sudoers(): def setup_sudoers(user):
with open('/etc/sudoers.d/frappe', 'w') as f: with open('/etc/sudoers.d/frappe', 'w') as f:
f.write("{user} ALL=(ALL) NOPASSWD: {supervisorctl} restart frappe\:\n".format( f.write("{user} ALL=(ALL) NOPASSWD: {supervisorctl} restart frappe\:\n".format(
user=getpass.getuser(), user=user,
supervisorctl=subprocess.check_output('which supervisorctl', shell=True).strip())) supervisorctl=subprocess.check_output('which supervisorctl', shell=True).strip()))
def setup_logging(bench='.'): def setup_logging(bench='.'):