diff --git a/scripts/vm/network/security_group.py b/scripts/vm/network/security_group.py index 6be06edbfcd..ebd0039d9fa 100755 --- a/scripts/vm/network/security_group.py +++ b/scripts/vm/network/security_group.py @@ -1369,13 +1369,13 @@ def verify_network_rules(vm_name, vm_id, vm_ip, vm_ip6, vm_mac, vif, brname, sec vm_id = vm_name.split("-")[-2] if brname is None: - brname = execute("virsh domiflist %s |grep -w '%s' |tr -s ' '|cut -d ' ' -f3" % (vm_name, vm_mac)).strip() + brname = execute("virsh domiflist %s |grep -w '%s' | awk '{print $3}'" % (vm_name, vm_mac)).strip() if not brname: print("Cannot find bridge") sys.exit(1) if vif is None: - vif = execute("virsh domiflist %s |grep -w '%s' |tr -s ' '|cut -d ' ' -f1" % (vm_name, vm_mac)).strip() + vif = execute("virsh domiflist %s |grep -w '%s' | awk '{print $1}'" % (vm_name, vm_mac)).strip() if not vif: print("Cannot find vif") sys.exit(1) diff --git a/test/integration/component/test_multiple_nic_support.py b/test/integration/component/test_multiple_nic_support.py index 5b1bb7194ff..333dae58c7d 100644 --- a/test/integration/component/test_multiple_nic_support.py +++ b/test/integration/component/test_multiple_nic_support.py @@ -224,7 +224,7 @@ class TestMulipleNicSupport(cloudstackTestCase): cls.virtual_machine1.default_network_id = nic.networkid break except Exception as e: - cls.fail(f"Exception while deploying virtual machine: {e}") + cls.fail("Exception while deploying virtual machine: %s" % {e}) try: cls.virtual_machine2 = VirtualMachine.create( @@ -243,7 +243,7 @@ class TestMulipleNicSupport(cloudstackTestCase): cls.virtual_machine2.default_network_id = nic.networkid break except Exception as e: - cls.fail(f"Exception while deploying virtual machine: {e}") + cls.fail("Exception while deploying virtual machine: %s" % {e}) cls._cleanup.append(cls.virtual_machine1) cls._cleanup.append(cls.virtual_machine2)