Fix output decoding and stripping for passwords
This commit is contained in:
parent
1adab407e8
commit
49be06d41f
@ -7,8 +7,8 @@ from PyInquirer import prompt
|
||||
|
||||
from autonomic.config import ACTIONS_DIR, INFRA_DIR, PASS_STORE_DIR
|
||||
from autonomic.infra import get_passwd, run_play
|
||||
from autonomic.utils import git_status, qlist
|
||||
from autonomic.settings import get
|
||||
from autonomic.utils import git_status, qlist
|
||||
|
||||
|
||||
@click.command()
|
||||
|
@ -40,4 +40,4 @@ def get_passwd(path):
|
||||
cmd = ["pass", "show", path]
|
||||
output = run(cmd, cwd=INFRA_DIR, env=env)
|
||||
|
||||
return output.decode("utf-8").strip()
|
||||
return output.strip()
|
||||
|
@ -8,10 +8,11 @@ things here.
|
||||
"""
|
||||
|
||||
from os import chdir
|
||||
from subprocess import check_output, call
|
||||
from subprocess import call, check_output
|
||||
|
||||
from psutil import process_iter
|
||||
|
||||
from autonomic.config import INFRA_DIR
|
||||
from autonomic.logger import log
|
||||
from autonomic.yaml import yaml
|
||||
|
||||
@ -32,7 +33,9 @@ def run(cmd, cwd=None, interactive=False, **kwargs):
|
||||
|
||||
if interactive:
|
||||
return call(cmd, **kwargs)
|
||||
return check_output(cmd, **kwargs)
|
||||
|
||||
output = check_output(cmd, **kwargs)
|
||||
return output.decode("utf-8")
|
||||
except Exception as exception:
|
||||
msg = "{} failed! Saw {}".format(" ".join(cmd), str(exception))
|
||||
exit(msg)
|
||||
|
@ -15,7 +15,7 @@ def test_run_cwd(tmp_path):
|
||||
testfile.write_text("hello, world")
|
||||
|
||||
output = run(["ls"], cwd=directory.absolute())
|
||||
assert "testfile.txt" in output.decode()
|
||||
assert "testfile.txt" in output
|
||||
|
||||
|
||||
def test_make_qlist():
|
||||
|
Reference in New Issue
Block a user