Did I find the right examples for you? yes no

All Samples(10)  |  Call(5)  |  Derive(0)  |  Import(5)
Introspect celeryd defaults file in order to get its username 

        def get_default_celeryd_username():
    """ Introspect celeryd defaults file in order to get its username """
    user = None
    try:
        with open('/etc/default/celeryd') as celeryd_defaults:
            for line in celeryd_defaults.readlines():
                if 'CELERYD_USER=' in line:
                    user = re.findall('"([^"]*)"', line)[0]
    finally:
        if user is None:
            raise CommandError("Can not find the default celeryd username")
    return user
        


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
 
    def __init__(self, *args, **kwargs):
        # Options are defined in an __init__ method to support swapping out
        # custom user models in tests.
        super(Command, self).__init__(*args, **kwargs)
        default_username = get_default_celeryd_username()

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
    def __init__(self, *args, **kwargs):
        super(Command, self).__init__(*args, **kwargs)
        self.option_list = BaseCommand.option_list + (
            make_option('--username', dest='username', default=get_default_celeryd_username(),
                help='Specifies the system user that would generate the firmwares.'),

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
    def __init__(self, *args, **kwargs):
        super(Command, self).__init__(*args, **kwargs)
        self.option_list = BaseCommand.option_list + (
            make_option('--user', dest='user', default=get_default_celeryd_username(),
                help='uWSGI daemon user.'),

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
    def __init__(self, *args, **kwargs):
        super(Command, self).__init__(*args, **kwargs)
        self.option_list = BaseCommand.option_list + (
            make_option('--user', dest='user', default=get_default_celeryd_username(),
                help='WSGIDaemonProcess user.'),

src/c/o/confine-controller-0.10.5/controller/apps/monitor/management/commands/setuplocalmonitor.py   confine-controller(Download)
 
from controller.utils.paths import get_site_root
from controller.utils.system import run, get_default_celeryd_username
 
 
    def __init__(self, *args, **kwargs):
        # Options are defined in an __init__ method to support swapping out
        # custom user models in tests.
        super(Command, self).__init__(*args, **kwargs)
        default_username = get_default_celeryd_username()