bts_osmotrx: Fix mkdtemp use in python < 3.5
We are currently seeing this issues in prod setup, which uses python
3.4:
File "/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/bts_osmotrx.py", line 44, in __init__
self.pcu_sk_tmp_dir = tempfile.mkdtemp(None, 'ogtpcusk', None)
File "/usr/lib/python3.4/tempfile.py", line 432, in mkdtemp
file = _os.path.join(dir, prefix + name + suffix)
TypeError: Can't convert 'NoneType' object to str implicitly
Acording to mkdtemp man in python3:
"Changed in version 3.5: suffix, prefix, and dir may now be supplied in
bytes in order to obtain a bytes return value. Prior to this, only str
was allowed. suffix and prefix now accept and default to None to cause
an appropriate default value to be used."
This issue went unnoticed because the RnD env is running debian 9, which
probably has python version >= 3.5.
Change-Id: If3226183fe21b4820149b1d03207193dc6f139e2
diff --git a/src/osmo_gsm_tester/bts_osmotrx.py b/src/osmo_gsm_tester/bts_osmotrx.py
index 3077b0f..6130ca9 100644
--- a/src/osmo_gsm_tester/bts_osmotrx.py
+++ b/src/osmo_gsm_tester/bts_osmotrx.py
@@ -41,7 +41,7 @@
self.suite_run = suite_run
self.conf = conf
self.env = {}
- self.pcu_sk_tmp_dir = tempfile.mkdtemp(None, 'ogtpcusk', None)
+ self.pcu_sk_tmp_dir = tempfile.mkdtemp('', 'ogtpcusk')
if len(self.pcu_socket_path().encode()) > 107:
raise log.Error('Path for pcu socket is longer than max allowed len for unix socket path (107):', self.pcu_socket_path())