示例#1
0
 def __init__(self, conf=None):
     self.nginx_manage_port = config.get_config('NGINX_MANAGE_PORT', '8089', conf)
     self.nginx_purge_path = config.get_config('NGINX_PURGE_PATH', '/purge', conf)
     self.nginx_healthcheck_path = config.get_config('NGINX_HEALTHCHECK_PATH',
                                                     '/healthcheck',
                                                     conf)
     self.config_manager = ConfigManager(conf)
示例#2
0
文件: nginx.py 项目: ricobl/rpaas
 def __init__(self, conf=None):
     self.nginx_manage_port = config.get_config('NGINX_MANAGE_PORT', '8089', conf)
     self.nginx_purge_path = config.get_config('NGINX_PURGE_PATH', '/purge', conf)
     self.nginx_healthcheck_path = config.get_config('NGINX_HEALTHCHECK_PATH',
                                                     '/healthcheck',
                                                     conf)
     self.config_manager = ConfigManager(conf)
示例#3
0
文件: nginx.py 项目: vfiebig/rpaas
 def __init__(self, conf=None):
     self.nginx_reload_path = config.get_config('NGINX_RELOAD_PATH', '/reload', conf)
     self.nginx_manage_port = config.get_config('NGINX_MANAGE_PORT', '8089', conf)
     self.nginx_dav_put_path = config.get_config('NGINX_DAV_PUT_PATH',
                                                 '/dav',
                                                 conf)
     self.nginx_healthcheck_path = config.get_config('NGINX_HEALTHCHECK_PATH',
                                                     '/healthcheck',
                                                     conf)
     self.config_manager = ConfigManager(conf)
示例#4
0
文件: nginx.py 项目: vfiebig/rpaas
 def __init__(self, conf=None):
     self.nginx_reload_path = config.get_config('NGINX_RELOAD_PATH',
                                                '/reload', conf)
     self.nginx_manage_port = config.get_config('NGINX_MANAGE_PORT', '8089',
                                                conf)
     self.nginx_dav_put_path = config.get_config('NGINX_DAV_PUT_PATH',
                                                 '/dav', conf)
     self.nginx_healthcheck_path = config.get_config(
         'NGINX_HEALTHCHECK_PATH', '/healthcheck', conf)
     self.config_manager = ConfigManager(conf)
示例#5
0
文件: nginx.py 项目: dmvieira/rpaas
 def _load_location_template(self, conf):
     template_txt = config.get_config("NGINX_LOCATION_TEMPLATE_TXT", None, conf)
     if template_txt:
         return template_txt
     template_url = config.get_config("NGINX_LOCATION_TEMPLATE_URL", None, conf)
     if template_url:
         rsp = requests.get(template_url)
         if rsp.status_code > 299:
             raise NginxError("Error trying to load location template: {} - {}".format(rsp.status_code, rsp.text))
         return rsp.text
     return """
示例#6
0
 def _load_location_template(self, conf):
     template_txt = config.get_config('NGINX_LOCATION_TEMPLATE_TXT', None, conf)
     if template_txt:
         return template_txt
     template_url = config.get_config('NGINX_LOCATION_TEMPLATE_URL', None, conf)
     if template_url:
         rsp = requests.get(template_url)
         if rsp.status_code > 299:
             raise NginxError("Error trying to load location template: {} - {}".
                              format(rsp.status_code, rsp.text))
         return rsp.text
     return """
示例#7
0
文件: storage.py 项目: carriercomm/hm
 def __init__(self, conf=None):
     self.config = conf
     self.mongo_uri = config.get_config('DBAAS_MONGODB_ENDPOINT', None, conf)
     if not self.mongo_uri:
         self.mongo_uri = config.get_config('MONGO_URI', 'mongodb://localhost:27017/', conf)
     client = pymongo.MongoClient(self.mongo_uri)
     try:
         self.db = client.get_default_database()
         self.mongo_database = self.db.name
     except pymongo.errors.ConfigurationError:
         self.mongo_database = config.get_config('MONGO_DATABASE', 'host_manager', conf)
         self.db = client[self.mongo_database]
示例#8
0
文件: nginx.py 项目: renatosis/rpaas
 def _load_location_template(self, conf, mode):
     mode = mode.upper()
     template_txt = config.get_config('NGINX_LOCATION_TEMPLATE_{}_TXT'.format(mode), None, conf)
     if template_txt:
         return template_txt
     template_url = config.get_config('NGINX_LOCATION_TEMPLATE_{}_URL'.format(mode), None, conf)
     if template_url:
         rsp = requests.get(template_url)
         if rsp.status_code > 299:
             raise NginxError("Error trying to load location template: {} - {}".
                              format(rsp.status_code, rsp.text))
         return rsp.text
     if mode == "DEFAULT":
         return NGINX_LOCATION_TEMPLATE_DEFAULT
     return NGINX_LOCATION_TEMPLATE_ROUTER
示例#9
0
文件: nginx.py 项目: tsuru/rpaas
 def _load_location_template(self, conf, mode):
     mode = mode.upper()
     template_txt = config.get_config('NGINX_LOCATION_TEMPLATE_{}_TXT'.format(mode), None, conf)
     if template_txt:
         return template_txt
     template_url = config.get_config('NGINX_LOCATION_TEMPLATE_{}_URL'.format(mode), None, conf)
     if template_url:
         rsp = requests.get(template_url)
         if rsp.status_code > 299:
             raise NginxError("Error trying to load location template: {} - {}".
                              format(rsp.status_code, rsp.text))
         return rsp.text
     if mode == "DEFAULT":
         return NGINX_LOCATION_TEMPLATE_DEFAULT
     return NGINX_LOCATION_TEMPLATE_ROUTER
示例#10
0
文件: nginx.py 项目: tsuru/rpaas
 def __init__(self, conf=None):
     self.nginx_manage_port = config.get_config('NGINX_MANAGE_PORT', '8089', conf)
     self.nginx_manage_port_tls = config.get_config('NGINX_MANAGE_PORT_TLS', '8090', conf)
     self.nginx_purge_path = config.get_config('NGINX_PURGE_PATH', '/purge', conf)
     self.nginx_expected_healthcheck = config.get_config('NGINX_HEALTHECK_EXPECTED',
                                                         'WORKING', conf)
     self.nginx_healthcheck_path = config.get_config('NGINX_HEALTHCHECK_PATH',
                                                     '/healthcheck', conf)
     self.nginx_healthcheck_app_path = config.get_config('NGINX_HEALTHCHECK_APP_PATH',
                                                         '/_nginx_healthcheck/', conf)
     self.nginx_app_port = config.get_config('NGINX_APP_PORT', '8080', conf)
     self.nginx_app_expected_healthcheck = config.get_config('NGINX_HEALTHECK_APP_EXPECTED',
                                                             'WORKING', conf)
     self.ca_cert = config.get_config('CA_CERT', None, conf)
     self.ca_path = "/tmp/rpaas_ca.pem"
     self.config_manager = ConfigManager(conf)
示例#11
0
文件: nginx.py 项目: renatosis/rpaas
 def __init__(self, conf=None):
     self.nginx_manage_port = config.get_config('NGINX_MANAGE_PORT', '8089', conf)
     self.nginx_manage_port_tls = config.get_config('NGINX_MANAGE_PORT_TLS', '8090', conf)
     self.nginx_purge_path = config.get_config('NGINX_PURGE_PATH', '/purge', conf)
     self.nginx_expected_healthcheck = config.get_config('NGINX_HEALTHECK_EXPECTED',
                                                         'WORKING', conf)
     self.nginx_healthcheck_path = config.get_config('NGINX_HEALTHCHECK_PATH',
                                                     '/healthcheck', conf)
     self.nginx_healthcheck_app_path = config.get_config('NGINX_HEALTHCHECK_APP_PATH',
                                                         '/_nginx_healthcheck/', conf)
     self.nginx_app_port = config.get_config('NGINX_APP_PORT', '8080', conf)
     self.nginx_app_expected_healthcheck = config.get_config('NGINX_HEALTHECK_APP_EXPECTED',
                                                             'WORKING', conf)
     self.ca_cert = config.get_config('CA_CERT', None, conf)
     self.ca_path = "/tmp/rpaas_ca.pem"
     self.config_manager = ConfigManager(conf)
示例#12
0
文件: host.py 项目: carriercomm/hm
 def _current_group_alternate(cls, group, conf=None):
     alternates_count = int(config.get_config("HM_ALTERNATIVE_CONFIG_COUNT", 1, conf))
     hosts = model.storage(conf).list_hosts({'group': group})
     alterantives_map = collections.defaultdict(int)
     for host in hosts:
         alterantives_map[host.alternative_id] += 1
     min_alt_id = 0
     min_alt_count = None
     for i in xrange(alternates_count):
         if min_alt_count is None or alterantives_map[i] < min_alt_count:
             min_alt_id = i
             min_alt_count = alterantives_map[i]
     return min_alt_id
示例#13
0
 def _current_group_alternate(cls, group, conf=None):
     alternates_count = int(config.get_config("HM_ALTERNATIVE_CONFIG_COUNT", 1, conf))
     hosts = model.storage(conf).list_hosts({'group': group})
     alterantives_map = collections.defaultdict(int)
     for host in hosts:
         alterantives_map[host.alternative_id] += 1
     min_alt_id = 0
     min_alt_count = None
     for i in xrange(alternates_count):
         if min_alt_count is None or alterantives_map[i] < min_alt_count:
             min_alt_id = i
             min_alt_count = alterantives_map[i]
     return min_alt_id
示例#14
0
 def __init__(self, conf=None):
     self.nginx_manage_port = config.get_config('NGINX_MANAGE_PORT', '8089', conf)
     self.nginx_purge_path = config.get_config('NGINX_PURGE_PATH', '/purge', conf)
     self.nginx_expected_healthcheck = config.get_config('NGINX_HEALTHECK_EXPECTED',
                                                         'WORKING', conf)
     self.nginx_healthcheck_path = config.get_config('NGINX_HEALTHCHECK_PATH',
                                                     '/healthcheck', conf)
     self.nginx_healthcheck_app_path = config.get_config('NGINX_HEALTHCHECK_APP_PATH',
                                                         '/_nginx_healthcheck/', conf)
     self.nginx_app_port = config.get_config('NGINX_APP_PORT', '8080', conf)
     self.nginx_app_expected_healthcheck = config.get_config('NGINX_HEALTHECK_APP_EXPECTED',
                                                             'WORKING', conf)
     self.config_manager = ConfigManager(conf)
示例#15
0
 def _current_group_alternate(cls, group, conf, alternative_id_error):
     alternates_count = range(
         int(config.get_config("HM_ALTERNATIVE_CONFIG_COUNT", 1, conf)))
     alternates_valid = list(
         set(alternates_count) - set(alternative_id_error))
     if len(alternates_valid) == 0:
         raise NoMoreHMAlternativesAvailable
     hosts = model.storage(conf).list_hosts({'group': group})
     alterantives_map = collections.defaultdict(int)
     for host in hosts:
         alterantives_map[host.alternative_id] += 1
     min_alt_count = None
     for i in alternates_valid:
         if min_alt_count is None or alterantives_map[i] < min_alt_count:
             min_alt_id = i
             min_alt_count = alterantives_map[i]
     return min_alt_id
示例#16
0
 def _get_conf(self, key, default=config.undefined):
     return config.get_config(key, default, self.config)
示例#17
0
文件: __init__.py 项目: tsuru/hm
 def get_conf(self, name, default=config.undefined):
     return config.get_config(name, default, self.config)
示例#18
0
 def _get_conf(self, key, default=config.undefined):
     return config.get_config(key, default, self.config)
示例#19
0
文件: nginx.py 项目: dmvieira/rpaas
 def __init__(self, conf=None):
     self.nginx_manage_port = config.get_config("NGINX_MANAGE_PORT", "8089", conf)
     self.nginx_purge_path = config.get_config("NGINX_PURGE_PATH", "/purge", conf)
     self.nginx_healthcheck_path = config.get_config("NGINX_HEALTHCHECK_PATH", "/healthcheck", conf)
     self.config_manager = ConfigManager(conf)
示例#20
0
 def get_conf(self, name, default=config.undefined):
     return config.get_config(name, default, self.config)