Did I find the right examples for you? yes no

All Samples(9)  |  Call(0)  |  Derive(0)  |  Import(9)
Function decorator that checks if user has root permissions 

        def check_root(func):
    """ Function decorator that checks if user has root permissions """
    def wrapped(*args, **kwargs):
        if getpass.getuser() != 'root':
            cmd_name = func.__module__.split('.')[-1]
            raise CommandError("Sorry, '%s' must be executed as a superuser (root)" % cmd_name)
        return func(*args, **kwargs)
    return wrapped
        


src/c/o/confine-controller-0.10.5/controller/apps/mgmtnetworks/tinc/management/commands/setuptincd.py   confine-controller(Download)
from controller import settings
from controller.utils import update_settings
from controller.utils.system import check_root, run, get_default_celeryd_username
from nodes.models import Server
 

src/c/o/confine-controller-0.10.5/controller/apps/firmware/management/commands/setupfirmware.py   confine-controller(Download)
from optparse import make_option
 
from django.core.management.base import BaseCommand, CommandError
 
from controller.utils.system import run, check_root, get_default_celeryd_username

src/c/o/confine-controller-0.10.5/controller/management/commands/setupnginx.py   confine-controller(Download)
 
from controller.utils.paths import get_project_root, get_site_root, get_project_name
from controller.utils.system import run, check_root, get_default_celeryd_username
 
from pki import ca

src/c/o/confine-controller-0.10.5/controller/management/commands/setupapache.py   confine-controller(Download)
 
from controller.utils.paths import get_project_root, get_site_root, get_project_name
from controller.utils.system import run, check_root, get_default_celeryd_username
 
from pki import ca

src/c/o/confine-controller-0.10.5/controller/management/commands/postupgradecontroller.py   confine-controller(Download)
 
from controller.utils.apps import is_installed
from controller.utils.system import run, check_root
 
 

src/c/o/confine-controller-0.10.5/controller/management/commands/setuppostgres.py   confine-controller(Download)
 
from controller.utils.paths import get_project_root
from controller.utils.system import run, check_root
 
 

src/c/o/confine-controller-0.10.5/controller/management/commands/upgradecontroller.py   confine-controller(Download)
from controller import get_version
from controller.utils import get_existing_pip_installation
from controller.utils.system import run, check_root
 
 

src/c/o/confine-controller-0.10.5/controller/management/commands/setupceleryd.py   confine-controller(Download)
 
from controller.utils.paths import get_site_root, get_controller_root
from controller.utils.system import run, check_root
 
 

src/c/o/confine-controller-0.10.5/controller/management/commands/startservices.py   confine-controller(Download)
 
from controller.settings import START_SERVICES
from controller.utils.system import run, check_root