minor fixes for test image, devops, c4k green

This commit is contained in:
Michael Jerger 2023-05-18 14:12:01 +02:00
parent 57a43085c0
commit d16a022728
2 changed files with 16 additions and 9 deletions

View file

@ -32,6 +32,7 @@ class InitService:
mixin_types = self.devops_factory.__parse_mixin_types__(input["mixin_types"]) mixin_types = self.devops_factory.__parse_mixin_types__(input["mixin_types"])
version = None version = None
default_mappings = []
if BuildType.C4K in build_types: if BuildType.C4K in build_types:
default_mappings = [ default_mappings = [

View file

@ -4,13 +4,16 @@ from os import chmod
from subprocess import run from subprocess import run
from pkg_resources import resource_string from pkg_resources import resource_string
import yaml import yaml
from os import environ
import deprecation import deprecation
from ..domain import Devops, Image, C4k, Release, BuildFile from ..domain import Devops, Image, C4k, Release, BuildFile
from ..python_util import execute from ..python_util import execute
class ProjectRepository: class ProjectRepository:
pass pass
class ResourceApi: class ResourceApi:
def read_resource(self, path: str) -> bytes: def read_resource(self, path: str) -> bytes:
return resource_string(__name__, path) return resource_string(__name__, path)
@ -100,25 +103,28 @@ class ExecutionApi:
print(output) print(output)
return output return output
class EnvironmentApi():
class EnvironmentApi:
def get(self, key): def get(self, key):
return environ.get(key) return environ.get(key)
class CredentialsApi(): class CredentialsApi:
def __init__ (self): def __init__(self):
self.execution_api = ExecutionApi() self.execution_api = ExecutionApi()
def gopass_field_from_path (self, path, field): def gopass_field_from_path(self, path, field):
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]) credential = self.execution_api.execute(["gopass", "show", path, field])
return credential return credential
def gopass_password_from_path (elf, path): def gopass_password_from_path(self, path):
credential = None credential = None
if path: if path:
print('get password for: ' + path) print("get password for: " + path)
credential = self.execution_api.execute(['gopass', 'show', '--password', path]) credential = self.execution_api.execute(
["gopass", "show", "--password", path]
)
return credential return credential