add a terraform api
This commit is contained in:
parent
74a95c8c59
commit
e4fef8b61c
2 changed files with 12 additions and 2 deletions
|
@ -6,5 +6,6 @@ from .infrastructure import (
|
||||||
EnvironmentApi,
|
EnvironmentApi,
|
||||||
CredentialsApi,
|
CredentialsApi,
|
||||||
GitApi,
|
GitApi,
|
||||||
|
TerraformApi,
|
||||||
)
|
)
|
||||||
from .repository import DevopsRepository, BuildFileRepository
|
from .repository import DevopsRepository, BuildFileRepository
|
||||||
|
|
|
@ -8,7 +8,7 @@ import yaml
|
||||||
|
|
||||||
class ResourceApi:
|
class ResourceApi:
|
||||||
def read_resource(self, path: str) -> bytes:
|
def read_resource(self, path: str) -> bytes:
|
||||||
return resource_string('ddadevops', path)
|
return resource_string("ddadevops", path)
|
||||||
|
|
||||||
|
|
||||||
class FileApi:
|
class FileApi:
|
||||||
|
@ -19,6 +19,9 @@ class FileApi:
|
||||||
self.execution_api.execute("rm -rf " + directory)
|
self.execution_api.execute("rm -rf " + directory)
|
||||||
self.execution_api.execute("mkdir -p " + 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):
|
def cp_force(self, src: str, target_dir: str):
|
||||||
self.execution_api.execute("cp -f " + src + "* " + target_dir)
|
self.execution_api.execute("cp -f " + src + "* " + target_dir)
|
||||||
|
|
||||||
|
@ -122,7 +125,9 @@ class CredentialsApi:
|
||||||
credential = None
|
credential = None
|
||||||
if path and field:
|
if path and field:
|
||||||
print("get field for: " + path + ", " + 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
|
return credential
|
||||||
|
|
||||||
def gopass_password_from_path(self, path):
|
def gopass_password_from_path(self, path):
|
||||||
|
@ -182,3 +187,7 @@ class GitApi:
|
||||||
|
|
||||||
def checkout(self, branch: str):
|
def checkout(self, branch: str):
|
||||||
return self.execution_api.execute(f"git checkout {branch}")
|
return self.execution_api.execute(f"git checkout {branch}")
|
||||||
|
|
||||||
|
|
||||||
|
class TerraformApi:
|
||||||
|
pass
|
||||||
|
|
Loading…
Reference in a new issue