Merge "Do not "grep" the output of an empty list"

This commit is contained in:
Zuul 2024-09-16 17:39:46 +00:00 committed by Gerrit Code Review
commit de66162e24

View File

@ -38,7 +38,8 @@ class OvnFdbAgingTest(wb_base.BaseTempestTestCaseOvn):
def _check_mac_in_ovn_sb_fdb(self, mac_address, is_present=True): def _check_mac_in_ovn_sb_fdb(self, mac_address, is_present=True):
def _check_mac(): def _check_mac():
cmd = '{} list FDB | grep mac'.format(self.sbctl) cmd = ('{} --format=list --bare --columns=mac list FDB; '
'true').format(self.sbctl)
fdb_list = self.run_on_master_controller(cmd).lower() fdb_list = self.run_on_master_controller(cmd).lower()
if is_present: if is_present:
return mac_address.lower() in fdb_list return mac_address.lower() in fdb_list