Only return hacluster nodes from list_nodes()
list_nodes() recently had some changes to run 'crm node show' in jammy+ instead of 'crm node status'. The difference is that 'crm node show' returns the pacemaker-remote nodes in addition to the hacluster nodes. This change limits the nodes returned by list_nodes() to the hacluster nodes (ie. the nodes that have a node ID). Closes-Bug: #1995295 Change-Id: Ia405d4270f56c949f79167f8b75c1304b598b918
This commit is contained in:
parent
45310a2270
commit
a03b0b2a87
|
@ -192,7 +192,7 @@ def list_nodes():
|
||||||
cmd = ['crm', 'node', 'show']
|
cmd = ['crm', 'node', 'show']
|
||||||
out = subprocess.check_output(cmd).decode('utf-8')
|
out = subprocess.check_output(cmd).decode('utf-8')
|
||||||
for line in out.strip().split('\n'):
|
for line in out.strip().split('\n'):
|
||||||
if re.match(r'^\S+', line):
|
if re.match(r'^\S+\(\d+\)', line):
|
||||||
line = line.split('(')[0]
|
line = line.split('(')[0]
|
||||||
line = line.split(':')[0]
|
line = line.split(':')[0]
|
||||||
nodes.append(line)
|
nodes.append(line)
|
||||||
|
|
|
@ -379,8 +379,7 @@ class TestPcmk(unittest.TestCase):
|
||||||
|
|
||||||
self.assertSequenceEqual(
|
self.assertSequenceEqual(
|
||||||
pcmk.list_nodes(),
|
pcmk.list_nodes(),
|
||||||
['juju-3f6cb6-zaza-4135aa8b2509-8.project.serverstack',
|
['juju-c1-zaza-3', 'juju-c1-zaza-5']
|
||||||
'juju-c1-zaza-3', 'juju-c1-zaza-5']
|
|
||||||
)
|
)
|
||||||
check_output.assert_called_with(['crm', 'node', 'show'])
|
check_output.assert_called_with(['crm', 'node', 'show'])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue