make gopass yml syntax accessable

This commit is contained in:
jem 2020-04-11 15:12:02 +02:00
parent bb04af61d9
commit c506500936
3 changed files with 21 additions and 5 deletions

View file

@ -28,7 +28,7 @@ use_plugin("python.distutils")
default_task = "publish"
name = "ddadevops"
version = "0.5.0.dev1"
version = "0.5.0.dev2"
summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud"
description = __doc__
authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")]

View file

@ -4,7 +4,7 @@ terraform, dda-pallet, aws & hetzner-cloud.
"""
from .credential import gopass_credential_from_env_path, gopass_credential_from_path
from .credential import gopass_credential_from_env_path, gopass_credential_from_path, gopass_password_from_path, gopass_field_from_path
from .devops_build import DevopsBuild, create_devops_build_config, get_devops_build
from .devops_terraform_build import WorkaroundTerraform, DevopsTerraformBuild, create_devops_terraform_build_config
from .hetzner_mixin import HetznerMixin, add_hetzner_mixin_config

View file

@ -4,17 +4,33 @@ import sys
def gopass_credential_from_env_path (env_var):
env_path = os.environ.get(env_var, None)
return gopass_credential_from_path(env_path)
return gopass_password_from_path(env_path)
def gopass_credential_from_path (path):
return gopass_password_from_path(path)
def gopass_field_from_path (path, field):
credential = None
if path and field:
print('get credential for: ' + path)
if sys.version_info.major == 3:
credential = check_output(['gopass', 'show', path, field], encoding='UTF-8')
else:
credential = check_output(['gopass', 'show', path, field])
return credential
def gopass_password_from_path (path):
credential = None
if path:
print('get credential for: ' + path)
if sys.version_info.major == 3:
credential = check_output(['gopass', path], encoding='UTF-8')
credential = check_output(['gopass', 'show', '--password', path], encoding='UTF-8')
else:
credential = check_output(['gopass', path])
credential = check_output(['gopass', 'show', '--password', path])
return credential