mirror of
https://github.com/frappe/bench.git
synced 2025-01-09 16:36:25 +00:00
raise error if not root for setup production and sudoers command
This commit is contained in:
parent
eb8778f084
commit
6476c7eb72
@ -11,7 +11,7 @@ from .utils import set_nginx_port as _set_nginx_port
|
|||||||
from .utils import set_default_site as _set_default_site
|
from .utils import set_default_site as _set_default_site
|
||||||
from .utils import (build_assets, patch_sites, exec_cmd, update_bench, get_frappe, setup_logging,
|
from .utils import (build_assets, patch_sites, exec_cmd, update_bench, get_frappe, setup_logging,
|
||||||
get_config, update_config, restart_supervisor_processes, put_config, default_config, update_requirements,
|
get_config, update_config, restart_supervisor_processes, put_config, default_config, update_requirements,
|
||||||
backup_all_sites, backup_site, get_sites, prime_wheel_cache)
|
backup_all_sites, backup_site, get_sites, prime_wheel_cache, is_root)
|
||||||
from .app import get_app as _get_app
|
from .app import get_app as _get_app
|
||||||
from .app import new_app as _new_app
|
from .app import new_app as _new_app
|
||||||
from .app import pull_all_apps
|
from .app import pull_all_apps
|
||||||
@ -215,6 +215,9 @@ def setup():
|
|||||||
@click.argument('user')
|
@click.argument('user')
|
||||||
def setup_sudoers(user):
|
def setup_sudoers(user):
|
||||||
"Add commands to sudoers list for execution without password"
|
"Add commands to sudoers list for execution without password"
|
||||||
|
if not is_root():
|
||||||
|
print 'superuser privileges required for this command'
|
||||||
|
sys.exit(1)
|
||||||
_setup_sudoers(user)
|
_setup_sudoers(user)
|
||||||
|
|
||||||
@click.command('nginx')
|
@click.command('nginx')
|
||||||
@ -230,6 +233,9 @@ def setup_supervisor():
|
|||||||
@click.command('production')
|
@click.command('production')
|
||||||
def setup_production():
|
def setup_production():
|
||||||
"setup bench for production"
|
"setup bench for production"
|
||||||
|
if not is_root():
|
||||||
|
print 'superuser privileges required for this command'
|
||||||
|
sys.exit(1)
|
||||||
_setup_production()
|
_setup_production()
|
||||||
|
|
||||||
@click.command('auto-update')
|
@click.command('auto-update')
|
||||||
|
@ -275,4 +275,6 @@ def prime_wheel_cache(bench='.'):
|
|||||||
exec_cmd(cmd)
|
exec_cmd(cmd)
|
||||||
|
|
||||||
def is_root():
|
def is_root():
|
||||||
pass
|
if os.getuid() == 0:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user