summaryrefslogtreecommitdiff
path: root/ironic_python_agent/agent.py
diff options
context:
space:
mode:
authorRiccardo Pittau <elfosardo@gmail.com>2019-02-04 09:47:52 +0100
committerRiccardo Pittau <elfosardo@gmail.com>2019-02-04 09:55:08 +0100
commitd525f8a07f2b223f7c7455a8fa4c8aad9b914d9b (patch)
tree301cdd4912d1d7ed33ac836b1869323a24818549 /ironic_python_agent/agent.py
parenta365ff42458a623f6eecb8838f7c809d6cafa37d (diff)
downloadironic-python-agent-d525f8a07f2b223f7c7455a8fa4c8aad9b914d9b.tar.gz
Making ironic-python-agent able to stop with python 3.x
The agent stop function will write a byte string 'a' to the pipe as a signal for the run function to end process. The run function is expecting a literal string. In python 2.x the byte string will automatically be converted to literal, while python 3.x won't do the conversion, causing the process to never stop. This patch will fix that behavior, allowing the IPA to correctly stop using python 3.x. Story: 2004928 Task: 29308 Change-Id: Iad16e8bed2436d961dea8ddaec1c2724225b4097
Diffstat (limited to 'ironic_python_agent/agent.py')
-rw-r--r--ironic_python_agent/agent.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/ironic_python_agent/agent.py b/ironic_python_agent/agent.py
index 819bb91c..c4b42f76 100644
--- a/ironic_python_agent/agent.py
+++ b/ironic_python_agent/agent.py
@@ -111,7 +111,7 @@ class IronicPythonAgentHeartbeater(threading.Thread):
try:
while True:
if p.poll(interval * 1000):
- if os.read(self.reader, 1) == 'a':
+ if os.read(self.reader, 1).decode() == 'a':
break
self.do_heartbeat()