Hi,
Below condition in statement 1 and 2 checks the number of boot statement set in switch matches with number of member switches available to ensure that correct boot statement is set for every member switch. Both statement 1 and 2 work when i give them individually.
But they fail when i use to it in assert statement as ‘OR’ conditional. How should i modify the syntax to make it work?
Statament 1:
show_boot_new.stdout[0] | regex_findall(‘BOOT variable = flash:packages.conf’) | length == show_switch.stdout[0] | regex_findall(‘Ready’) | length
Statement 2:
show_boot_new.stdout[0] | regex_findall(‘BOOT variable = flash:cat3k_caa-universalk9.16.09.06.SPA.conf’) | length == show_switch.stdout[0] | regex_findall(‘Ready’) | length
- assert:
that: - show_boot_new.stdout[0] | regex_findall(‘BOOT variable = flash:packages.conf’) | length == show_switch.stdout[0] | regex_findall(‘Ready’) | length or
show_boot_new.stdout[0] | regex_findall(‘BOOT variable = flash:cat3k_caa-universalk9.16.09.06.SPA.conf’) | length == show_switch.stdout[0] | regex_findall(‘Ready’) | length
fail_msg: “BOOT STATEMENT IS NOT SET FOR ALL MEMBERS SWITCHES. PLAYBOOK IS ENDING FOR HOST.”
success_msg: “BOOT STATEMENT IS SET FOR ALL MEMBER SWITCHES”
Thanks,
Vikram