diff --git a/hooks/pcmk.py b/hooks/pcmk.py index 6210b93..41ed7c7 100644 --- a/hooks/pcmk.py +++ b/hooks/pcmk.py @@ -192,7 +192,7 @@ def list_nodes(): cmd = ['crm', 'node', 'show'] out = subprocess.check_output(cmd).decode('utf-8') 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] nodes.append(line) diff --git a/unit_tests/test_pcmk.py b/unit_tests/test_pcmk.py index 65de5ea..a3d3cee 100644 --- a/unit_tests/test_pcmk.py +++ b/unit_tests/test_pcmk.py @@ -379,8 +379,7 @@ class TestPcmk(unittest.TestCase): self.assertSequenceEqual( 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'])