Merge "Add a newline when writing the server state file" into stable/yoga
This commit is contained in:
commit
6054d369e4
@ -160,7 +160,7 @@ class HAProxyQuery(object):
|
|||||||
result = self._query('show servers state')
|
result = self._query('show servers state')
|
||||||
# No need for binary mode, the _query converts bytes to ascii.
|
# No need for binary mode, the _query converts bytes to ascii.
|
||||||
with open(state_file_path, 'w', encoding='utf-8') as fh:
|
with open(state_file_path, 'w', encoding='utf-8') as fh:
|
||||||
fh.write(result)
|
fh.write(result + "\n")
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# Catch any exception - may be socket issue, or write permission
|
# Catch any exception - may be socket issue, or write permission
|
||||||
|
@ -158,7 +158,7 @@ class QueryTestCase(base.TestCase):
|
|||||||
|
|
||||||
self.q.save_state(filename)
|
self.q.save_state(filename)
|
||||||
|
|
||||||
mock_fh.write.assert_called_once_with('DATA')
|
mock_fh.write.assert_called_once_with('DATA\n')
|
||||||
|
|
||||||
def test_save_state_error(self):
|
def test_save_state_error(self):
|
||||||
"""save_state() should swallow exceptions"""
|
"""save_state() should swallow exceptions"""
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fixed a "corrupted global server state file" error in Centos 9 Stream when
|
||||||
|
reloading the state of the servers after restarting haproxy.
|
||||||
|
It also fixed the recovering of the operational state of the servers in
|
||||||
|
haproxy after its restart.
|
Loading…
Reference in New Issue
Block a user