From 0c51a762486a48af5804def8e7b5307361e5a4d9 Mon Sep 17 00:00:00 2001 From: jem Date: Fri, 17 Apr 2020 19:09:04 +0200 Subject: [PATCH] unify prog-exec --- build.py | 2 +- src/main/python/ddadevops/credential.py | 18 +++--------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/build.py b/build.py index 61caf09..41456ed 100644 --- a/build.py +++ b/build.py @@ -28,7 +28,7 @@ use_plugin("python.distutils") default_task = "publish" name = "ddadevops" -version = "0.6.0.dev2" +version = "0.6.0.dev3" summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud" description = __doc__ authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")] diff --git a/src/main/python/ddadevops/credential.py b/src/main/python/ddadevops/credential.py index 57635c5..9a912b1 100644 --- a/src/main/python/ddadevops/credential.py +++ b/src/main/python/ddadevops/credential.py @@ -1,6 +1,4 @@ -from subprocess import check_output, call -import os -import sys +from .python_util import * import deprecation @deprecation.deprecated(deprecated_in="0.5.0", removed_in="1.0", @@ -17,25 +15,15 @@ def gopass_credential_from_path (path): def gopass_field_from_path (path, field): credential = None - if path and field: print('get field for: ' + path + ', ' + field) - if sys.version_info.major == 3: - credential = check_output(['gopass', 'show', path, field], encoding='UTF-8') - else: - credential = check_output(['gopass', 'show', path, field]) - + credential = execute(['gopass', 'show', path, field]) return credential def gopass_password_from_path (path): credential = None - if path: print('get password for: ' + path) - if sys.version_info.major == 3: - credential = check_output(['gopass', 'show', '--password', path], encoding='UTF-8') - else: - credential = check_output(['gopass', 'show', '--password', path]) - + credential = execute(['gopass', 'show', '--password', path]) return credential