Skip to content

Commit

Permalink
Interpret subprocess output as strings
Browse files Browse the repository at this point in the history
Previously the subprocess output would be reported as byte strings,
which in Python 3.10 would add a b'' prefix, interfering with the
output. By interpreting them as proper UTF-8 strings, we ensure
that the original functionality is restored.
  • Loading branch information
rajadain committed Jul 10, 2024
1 parent 92755b0 commit 25bc332
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions deployment/packer/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def get_git_sha():
'rev-parse',
'HEAD']

return subprocess.check_output(git_command).rstrip()
return subprocess.check_output(
git_command,
universal_newlines=True).rstrip()


def get_git_branch():
Expand All @@ -69,7 +71,9 @@ def get_git_branch():
'--abbrev-ref',
'HEAD']

return subprocess.check_output(git_command).rstrip()
return subprocess.check_output(
git_command,
universal_newlines=True).rstrip()


def get_git_desc():
Expand All @@ -81,7 +85,9 @@ def get_git_desc():
'--dirty',
'--abbrev=40']

return subprocess.check_output(git_command).rstrip()
return subprocess.check_output(
git_command,
universal_newlines=True).rstrip()


def run_packer(mmw_config, machine_types, aws_profile):
Expand Down

0 comments on commit 25bc332

Please sign in to comment.