fix linting

This commit is contained in:
Michael Jerger 2023-05-26 15:38:12 +02:00
parent 406a5e6333
commit da872af76e
5 changed files with 18 additions and 13 deletions

View file

@ -2,7 +2,7 @@ from pathlib import Path
from dda_python_terraform import Terraform, IsFlagged
from packaging import version
from ..domain import Devops, TerraformDomain, BuildType
from ..domain import Devops, BuildType
from ..infrastructure import FileApi, ResourceApi, TerraformApi
@ -76,7 +76,7 @@ class TerraformService:
# TODO: internal?
def init_client(self, devops: Devops):
terraform_domain: TerraformDomain = devops.specialized_builds[
terraform_domain = devops.specialized_builds[
BuildType.TERRAFORM
]
terraform = Terraform(

View file

@ -38,9 +38,15 @@ class InitService:
)
def initialize(self, inp: dict) -> Devops:
build_types = self.devops_factory.__parse_build_types__(inp.get("build_types", []))
mixin_types = self.devops_factory.__parse_mixin_types__(inp.get("mixin_types", []))
provider_types = TerraformDomain.parse_provider_types(inp.get("tf_provider_types", []))
build_types = self.devops_factory.__parse_build_types__(
inp.get("build_types", [])
)
mixin_types = self.devops_factory.__parse_mixin_types__(
inp.get("mixin_types", [])
)
provider_types = TerraformDomain.parse_provider_types(
inp.get("tf_provider_types", [])
)
version = None
default_mappings = []
@ -50,7 +56,7 @@ class InitService:
if BuildType.IMAGE in build_types:
default_mappings += Image.get_mapping_default()
if BuildType.TERRAFORM in build_types:
if ProviderType.DIGITALOCEAN in provider_types:
if ProviderType.DIGITALOCEAN in provider_types:
default_mappings += Digitalocean.get_mapping_default()
if ProviderType.HETZNER in provider_types:
default_mappings += Hetzner.get_mapping_default()

View file

@ -1,4 +1,4 @@
from typing import List, Dict, Set
from typing import List, Dict, Set, Any
from .common import Validateable, CredentialMappingDefault
@ -61,7 +61,7 @@ class Digitalocean(Validateable, CredentialMappingDefault):
)
return result
def backend_config(self) -> map:
def backend_config(self) -> Dict[str, Any]:
result = {}
if self.do_as_backend:
result = {

View file

@ -1,6 +1,7 @@
from typing import List, Dict, Set
from .common import Validateable, CredentialMappingDefault
class Hetzner(Validateable, CredentialMappingDefault):
def __init__(
self,
@ -17,10 +18,8 @@ class Hetzner(Validateable, CredentialMappingDefault):
return {"provider_registry.tf", "hetzner_provider.tf", "hetzner_mixin_vars.tf"}
def project_vars(self):
return {
"hetzner_api_key": self.hetzner_api_key
}
return {"hetzner_api_key": self.hetzner_api_key}
def is_local_state(self):
return True

View file

@ -83,7 +83,7 @@ class TerraformDomain(Validateable):
result = result and provider.is_local_state()
return result
def backend_config(self) -> map:
def backend_config(self) -> Dict[str, Any]:
result = {}
for provider in self.providers.values():
result.update(provider.backend_config())