Exemple #1
0
 def init_config(self, config=None):
     self.config = config
     self.nginx_manager = nginx.Nginx(config)
     self.consul_manager = consul_manager.ConsulManager(config)
     self.host_manager_name = self._get_conf("HOST_MANAGER", "cloudstack")
     self.lb_manager_name = self._get_conf("LB_MANAGER",
                                           "networkapi_cloudstack")
     self.task_manager = TaskManager(config)
     self.lock_manager = lock.Lock(app.backend.client)
     self.hc = hc.Dumb()
     self.storage = storage.MongoDBStorage(config)
     self.acl_manager = acl.Dumb(self.consul_manager)
     if check_option_enable(self._get_conf("CHECK_ACL_API", None)):
         self.acl_manager = acl.AclManager(config, self.consul_manager,
                                           lock.Lock(app.backend.client))
     hc_url = self._get_conf("HCAPI_URL", None)
     if hc_url:
         self.hc = hc.HCAPI(self.storage,
                            url=hc_url,
                            user=self._get_conf("HCAPI_USER"),
                            password=self._get_conf("HCAPI_PASSWORD"),
                            hc_format=self._get_conf(
                                "HCAPI_FORMAT", "http://{}:8080/"))
     self.retry_countdown = os.environ.get("RETRY_COUNTDOWN", None)
     if self.retry_countdown:
         self.retry_countdown = int(self.retry_countdown)
     self.max_retries = os.environ.get("MAX_RETRIES", None)
     if self.max_retries:
         self.max_retries = int(self.max_retries)
Exemple #2
0
 def __init__(self, config=None):
     self.config = config
     self.storage = storage.MongoDBStorage(config)
     self.consul_manager = consul_manager.ConsulManager(config)
     self.nginx_manager = nginx.Nginx(config)
     self.task_manager = tasks.TaskManager(config)
     self.service_name = os.environ.get("RPAAS_SERVICE_NAME", "rpaas")
     self.acl_manager = acl.Dumb(self.consul_manager)
     if check_option_enable(os.environ.get("CHECK_ACL_API", None)):
         self.acl_manager = acl.AclManager(config, self.consul_manager, lock.Lock(tasks.app.backend.client))