securitygroups: Fix security_groups for c8/suse (#5354)

* Fix security_groups for c8/suse

* security_group.py: revert a minor change in #5348

Co-authored-by: Wei Zhou <weizhou@apache.org>
This commit is contained in:
davidjumani 2021-08-24 13:07:52 +05:30 committed by GitHub
parent bc28ae4606
commit f822547c3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -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)

View File

@ -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)