Include shell parameter in ExecutionApi

This commit is contained in:
bom 2023-05-19 13:56:43 +02:00
parent db0d560e12
commit 72b5e19ffe

View file

@ -90,14 +90,13 @@ class ImageApi:
class ExecutionApi: class ExecutionApi:
def execute(self, command: str, dry_run=False): def execute(self, command: str, dry_run=False, shell=True):
output = "" output = ""
if dry_run: if dry_run:
print(command) print(command)
else: else:
output = check_output(command, encoding="UTF-8", shell=True) output = check_output(command, encoding="UTF-8", shell=shell)
output = output.rstrip() output = output.rstrip()
print(output)
return output return output
def execute_live(command): def execute_live(command):
@ -121,7 +120,7 @@ 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]) 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):
@ -129,7 +128,7 @@ class CredentialsApi:
if path: if path:
print("get password for: " + path) print("get password for: " + path)
credential = self.execution_api.execute( credential = self.execution_api.execute(
["gopass", "show", "--password", path] ["gopass", "show", "--password", path], shell=False
) )
return credential return credential