예제 #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
파일: tasks.py 프로젝트: carriercomm/rpaas
 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
파일: __init__.py 프로젝트: carriercomm/hm
 def get_conf(self, name, default=config.undefined):
     return config.get_config(name, default, self.config)