Skip to content

WIP: Fix Version compatible and refactor check_cluster_conf_ssh#310

Open
Dawei-Pang wants to merge 1 commit intoClusterLabs:masterfrom
Dawei-Pang:address_team_9132_refactor_check_cluster_conf_ssh
Open

WIP: Fix Version compatible and refactor check_cluster_conf_ssh#310
Dawei-Pang wants to merge 1 commit intoClusterLabs:masterfrom
Dawei-Pang:address_team_9132_refactor_check_cluster_conf_ssh

Conversation

@Dawei-Pang
Copy link
Contributor

if ssh.is_valid_command("crm_attribute --list-options=cluster --all --output-as=xml"):
if not ssh.check_cluster_conf_ssh("crm_attribute --list-options=cluster --all --output-as=xml | grep 'advanced=\"0\"' | sed 's/.*name=\"*\\([^\\\"]*\\)\".*/\\1/'", lst, silent=True, anycheck=False):
out = ssh.get_cluster_conf_ssh_output("crm_attribute --list-options=cluster --all --output-as=xml | grep 'advanced=\"0\"' | sed 's/.*name=\"*\\([^\\\"]*\\)\".*/\\1/'")
if not all(_ in out for _ in lst):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it means that out must be iterable (like list/dict), we also need to consider out is possibly string type.

return True

def check_cluster_conf_ssh(self, command, mustmatch, silent=False, anycheck=False):
def get_cluster_conf_ssh_output(self, command):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a reminder: please make sure update all of check_cluster_conf_ssh to get_cluster_conf_ssh_output in this project

print(f"TEST: verify_primitive_removed: check primitive [{primitive}] is removed")
if self.check_cluster_conf_ssh("crm resource status | grep ocf::heartbeat:Dummy", ''):
out = self.get_cluster_conf_ssh_output("crm resource status | grep ocf::heartbeat:Dummy")
if out == '':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the logic is different with the lines in the original function:

        if isinstance(mustmatch, str):
            return mustmatch in out

please make sure out must be '' rather than ['a', 'b', ''], {'apple', ''}, {'': 'empty key value', 'id': 123} or any string.

@Dawei-Pang Dawei-Pang force-pushed the address_team_9132_refactor_check_cluster_conf_ssh branch from d55316c to cf16d8d Compare March 17, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants