fix(automate): Pass through working directory to superclass
This commit is contained in:
parent
aeca11024a
commit
30b60e9048
4 changed files with 10 additions and 8 deletions
|
@ -4,7 +4,7 @@ from typing import Tuple, Any, Optional
|
||||||
import jinja2
|
import jinja2
|
||||||
|
|
||||||
|
|
||||||
class BaseAutomation():
|
class BaseAutomation:
|
||||||
short_name: str = "base"
|
short_name: str = "base"
|
||||||
description: str = "Abstract base automation."
|
description: str = "Abstract base automation."
|
||||||
frequency: int
|
frequency: int
|
||||||
|
|
|
@ -2,7 +2,7 @@ from datetime import datetime, timedelta
|
||||||
import logging
|
import logging
|
||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
import fnmatch
|
import fnmatch
|
||||||
from typing import Tuple, List
|
from typing import Tuple, List, Any
|
||||||
|
|
||||||
from app.extensions import db
|
from app.extensions import db
|
||||||
from app.models.activity import Activity
|
from app.models.activity import Activity
|
||||||
|
@ -13,12 +13,12 @@ from app.terraform import BaseAutomation
|
||||||
class BlockMirrorAutomation(BaseAutomation):
|
class BlockMirrorAutomation(BaseAutomation):
|
||||||
patterns: List[str]
|
patterns: List[str]
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||||
"""
|
"""
|
||||||
Constructor method.
|
Constructor method.
|
||||||
"""
|
"""
|
||||||
self.patterns = []
|
self.patterns = []
|
||||||
super().__init__()
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def automate(self, full: bool = False) -> Tuple[bool, str]:
|
def automate(self, full: bool = False) -> Tuple[bool, str]:
|
||||||
self.fetch()
|
self.fetch()
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
|
|
||||||
from app.terraform.list import ListAutomation
|
from app.terraform.list import ListAutomation
|
||||||
|
@ -52,7 +54,7 @@ class ListGitlabAutomation(ListAutomation):
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||||
super().__init__()
|
super().__init__(*args, **kwargs)
|
||||||
if 'GITLAB_URL' in current_app.config:
|
if 'GITLAB_URL' in current_app.config:
|
||||||
self.template_parameters.append("gitlab_url")
|
self.template_parameters.append("gitlab_url")
|
||||||
|
|
|
@ -120,13 +120,13 @@ class ProxyFastlyAutomation(ProxyAutomation):
|
||||||
{% endfor %}{# group #}
|
{% endfor %}{# group #}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||||
"""
|
"""
|
||||||
Constructor method.
|
Constructor method.
|
||||||
"""
|
"""
|
||||||
# Requires Flask application context to read configuration
|
# Requires Flask application context to read configuration
|
||||||
self.subgroup_max = min(current_app.config.get("FASTLY_MAX_BACKENDS", 5), 20)
|
self.subgroup_max = min(current_app.config.get("FASTLY_MAX_BACKENDS", 5), 20)
|
||||||
super().__init__()
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def import_state(self, state: Optional[Any]) -> None:
|
def import_state(self, state: Optional[Any]) -> None:
|
||||||
proxies = Proxy.query.filter(
|
proxies = Proxy.query.filter(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue