proxy/meta: only create proxies for providers that are enabled
This commit is contained in:
parent
18d6f294f4
commit
3f07f0e08f
5 changed files with 13 additions and 1 deletions
|
@ -5,6 +5,7 @@ import datetime
|
|||
from collections import defaultdict
|
||||
from typing import Optional, Any, List, Dict
|
||||
|
||||
from flask import current_app
|
||||
from sqlalchemy import text
|
||||
|
||||
from app import app
|
||||
|
@ -65,10 +66,18 @@ class ProxyAutomation(TerraformAutomation):
|
|||
Whether this provider supports "smart" proxies.
|
||||
"""
|
||||
|
||||
cloud_name: str
|
||||
"""
|
||||
The name of the cloud provider used by this proxy provider. Used to determine if this provider can be enabled.
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def import_state(self, state: Any) -> None:
|
||||
raise NotImplementedError()
|
||||
|
||||
def enabled(self) -> bool:
|
||||
return current_app.config.get(self.cloud_name.upper() + "_ENABLED", False)
|
||||
|
||||
def tf_prehook(self) -> Optional[Any]: # pylint: disable=useless-return
|
||||
return None
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue