Skip to content

Commit

Permalink
Merge pull request #314 from giffels/fix/ssh-executor-stdin
Browse files Browse the repository at this point in the history
Fix type of sshexecutor stdin parameter
  • Loading branch information
giffels authored Nov 10, 2023
2 parents 580115a + 5bc20d4 commit 980d3d3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deployment-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
- uses: actions/checkout@v3
- name: Install dependencies on ${{ matrix.platform }}
run: |
export PATH=/Library/Frameworks/Python.framework/Versions/3.11/bin:$PATH
python3 -m pip install --upgrade pip
python3 -m pip install .[contrib]
python3 -m pip install coverage codecov
Expand Down
8 changes: 8 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
CHANGELOG
#########

[Unreleased] - 2023-11-10
=========================

Fixed
-----

* Fix type of sshexecutor stdin parameter

[0.8.0] - 2023-10-05
====================

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
category: fixed
summary: "Fix type of sshexecutor stdin parameter"
description: |
In the SSHExecutor it was assumed that asyncssh requires stdin to be in bytes format.
However, according to the documentation it is required to be in string format. Therefore, the type of stdin parameter
has been changed from byte format into string format.
pull requests:
- 314
2 changes: 1 addition & 1 deletion tardis/utilities/executors/sshexecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ async def run_command(self, command, stdin_input=None):
async with self.bounded_connection as ssh_connection:
try:
response = await ssh_connection.run(
command, check=True, input=stdin_input and stdin_input.encode()
command, check=True, input=stdin_input
)
except asyncssh.ProcessError as pe:
raise CommandExecutionFailure(
Expand Down
4 changes: 1 addition & 3 deletions tests/utilities_t/executors_t/test_sshexecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ async def run(self, command, input=None, **kwargs):
await asyncio.sleep(float(duration))
elif command != "Test":
raise ValueError(f"Unsupported mock command: {command}")
return AttributeDict(
stdout=input and input.decode(), stderr="TestError", exit_status=0
)
return AttributeDict(stdout=input, stderr="TestError", exit_status=0)

async def create_process(self):
@asynccontextmanager
Expand Down

0 comments on commit 980d3d3

Please sign in to comment.