当前位置: 首页>>代码示例>>Python>>正文


Python utils.validate_configuration函数代码示例

本文整理汇总了Python中swift.common.utils.validate_configuration函数的典型用法代码示例。如果您正苦于以下问题:Python validate_configuration函数的具体用法?Python validate_configuration怎么用?Python validate_configuration使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了validate_configuration函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, serialized_path, reload_time=15, ring_name=None):
     # can't use the ring unless HASH_PATH_SUFFIX is set
     validate_configuration()
     if ring_name:
         self.serialized_path = os.path.join(serialized_path, ring_name + ".ring.gz")
     else:
         self.serialized_path = os.path.join(serialized_path)
     self.reload_time = reload_time
     self._reload(force=True)
开发者ID:UoM-ResPlat-DevOps,项目名称:swift,代码行数:9,代码来源:ring.py

示例2: setup

    def setup(self, **kwargs):
        utils.validate_configuration()
        utils.drop_privileges(self.daemon.conf.get('user', 'swift'))
        utils.capture_stdio(self.logger, **kwargs)

        def kill_children(*args):
            self.running = False
            self.logger.info('SIGTERM received')
            signal.signal(signal.SIGTERM, signal.SIG_IGN)
            os.killpg(0, signal.SIGTERM)
            os._exit(0)

        signal.signal(signal.SIGTERM, kill_children)
        self.running = True
开发者ID:chenzhongtao,项目名称:swift,代码行数:14,代码来源:daemon.py

示例3: run

    def run(self, once=False, **kwargs):
        """Run the daemon"""
        utils.validate_configuration()
        utils.drop_privileges(self.conf.get('user', 'swift'))
        utils.capture_stdio(self.logger, **kwargs)

        def kill_children(*args):
            signal.signal(signal.SIGTERM, signal.SIG_IGN)
            os.killpg(0, signal.SIGTERM)
            sys.exit()

        signal.signal(signal.SIGTERM, kill_children)
        if once:
            self.run_once(**kwargs)
        else:
            self.run_forever(**kwargs)
开发者ID:prashanthpai,项目名称:swift,代码行数:16,代码来源:daemon.py

示例4: _initrp

def _initrp(conf_path, app_section, *args, **kwargs):
    try:
        conf = appconfig(conf_path, name=app_section)
    except Exception as e:
        raise ConfigFileError("Error trying to load config from %s: %s" % (conf_path, e))

    validate_configuration()

    # pre-configure logger
    log_name = conf.get("log_name", app_section)
    if "logger" in kwargs:
        logger = kwargs.pop("logger")
    else:
        logger = get_logger(conf, log_name, log_to_console=kwargs.pop("verbose", False), log_route="wsgi")

    # disable fallocate if desired
    if config_true_value(conf.get("disable_fallocate", "no")):
        disable_fallocate()

    monkey_patch_mimetools()
    return (conf, logger, log_name)
开发者ID:hannanabdul55,项目名称:swift,代码行数:21,代码来源:wsgi.py

示例5: _initrp

def _initrp(conf_path, app_section, *args, **kwargs):
    try:
        conf = appconfig(conf_path, name=app_section)
    except Exception as e:
        raise ConfigFileError("Error trying to load config from %s: %s" %
                              (conf_path, e))

    validate_configuration()

    # pre-configure logger
    log_name = conf.get('log_name', app_section)
    if 'logger' in kwargs:
        logger = kwargs.pop('logger')
    else:
        logger = get_logger(conf, log_name,
                            log_to_console=kwargs.pop('verbose', False),
                            log_route='wsgi')

    # disable fallocate if desired
    if config_true_value(conf.get('disable_fallocate', 'no')):
        disable_fallocate()

    return (conf, logger, log_name)
开发者ID:mahak,项目名称:swift,代码行数:23,代码来源:wsgi.py

示例6: run_wsgi

# TODO: pull pieces of this out to test
def run_wsgi(conf_file, app_section, *args, **kwargs):
    """
    Loads common settings from conf, then instantiates app and runs
    the server using the specified number of workers.

    :param conf_file: Path to paste.deploy style configuration file
    :param app_section: App name from conf file to load config from
    """

    try:
        conf = appconfig("config:%s" % conf_file, name=app_section)
    except Exception, e:
        print "Error trying to load config %s: %s" % (conf_file, e)
        return
    validate_configuration()

    # pre-configure logger
    log_name = conf.get("log_name", app_section)
    if "logger" in kwargs:
        logger = kwargs.pop("logger")
    else:
        logger = get_logger(conf, log_name, log_to_console=kwargs.pop("verbose", False), log_route="wsgi")

    # bind to address and port
    sock = get_socket(conf, default_port=kwargs.get("default_port", 8080))
    # remaining tasks should not require elevated privileges
    drop_privileges(conf.get("user", "swift"))

    # Ensure the application can be loaded before proceeding.
    loadapp("config:%s" % conf_file, global_conf={"log_name": log_name})
开发者ID:lixmgl,项目名称:Intern_OpenStack_Swift,代码行数:31,代码来源:wsgi.py

示例7: __init__

 def __init__(self, pickle_gz_path, reload_time=15):
     # can't use the ring unless HASH_PATH_SUFFIX is set
     validate_configuration()
     self.pickle_gz_path = pickle_gz_path
     self.reload_time = reload_time
     self._reload(force=True)
开发者ID:noodley,项目名称:swift,代码行数:6,代码来源:ring.py


注:本文中的swift.common.utils.validate_configuration函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。