Skip to content

Commit

Permalink
Fix for non-str ident (#1268)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shrews authored Jul 12, 2023
1 parent aef73cf commit 8301351
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ansible_runner/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def __init__(self, _input=None, status_handler=None, event_handler=None,
else:
project_artifacts = os.path.abspath(os.path.join(self.private_data_dir, 'artifacts'))
if ident := kwargs.get('ident'):
self.artifact_dir = os.path.join(project_artifacts, ident)
self.artifact_dir = os.path.join(project_artifacts, str(ident))
else:
self.artifact_dir = project_artifacts

Expand Down
16 changes: 16 additions & 0 deletions test/unit/test_streaming.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os

from ansible_runner.streaming import Processor


class TestProcessor:

def test_artifact_dir_with_int_ident(self, tmp_path):
kwargs = {
'private_data_dir': str(tmp_path),
'ident': 123,
}
p = Processor(**kwargs)
assert p.artifact_dir == os.path.join(kwargs['private_data_dir'],
'artifacts',
str(kwargs['ident']))

0 comments on commit 8301351

Please sign in to comment.