add a terraform api

This commit is contained in:
Michael Jerger 2023-05-24 14:16:27 +02:00
parent 74a95c8c59
commit e4fef8b61c
2 changed files with 12 additions and 2 deletions

View file

@ -6,5 +6,6 @@ from .infrastructure import (
EnvironmentApi,
CredentialsApi,
GitApi,
TerraformApi,
)
from .repository import DevopsRepository, BuildFileRepository

View file

@ -8,7 +8,7 @@ import yaml
class ResourceApi:
def read_resource(self, path: str) -> bytes:
return resource_string('ddadevops', path)
return resource_string("ddadevops", path)
class FileApi:
@ -19,6 +19,9 @@ class FileApi:
self.execution_api.execute("rm -rf " + directory)
self.execution_api.execute("mkdir -p " + directory)
def cp(self, src: str, target_dir: str):
self.execution_api.execute(f"cp {src} {target_dir}")
def cp_force(self, src: str, target_dir: str):
self.execution_api.execute("cp -f " + src + "* " + target_dir)
@ -122,7 +125,9 @@ class CredentialsApi:
credential = None
if path and field:
print("get field for: " + path + ", " + field)
credential = self.execution_api.execute(["gopass", "show", path, field], shell=False)
credential = self.execution_api.execute(
["gopass", "show", path, field], shell=False
)
return credential
def gopass_password_from_path(self, path):
@ -182,3 +187,7 @@ class GitApi:
def checkout(self, branch: str):
return self.execution_api.execute(f"git checkout {branch}")
class TerraformApi:
pass