python/semanage: Update Infiniband code to work on python3
Update Infiniband "port" and "key" listing and export to work on python3. {}.keys() does not support .sort() operation on Py3. Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
This commit is contained in:
parent
2927532b1c
commit
2d21207796
|
@ -1543,9 +1543,8 @@ class ibpkeyRecords(semanageRecords):
|
||||||
def customized(self):
|
def customized(self):
|
||||||
l = []
|
l = []
|
||||||
ddict = self.get_all(True)
|
ddict = self.get_all(True)
|
||||||
keys = ddict.keys()
|
|
||||||
keys.sort()
|
for k in sorted(ddict.keys()):
|
||||||
for k in keys:
|
|
||||||
if k[0] == k[1]:
|
if k[0] == k[1]:
|
||||||
l.append("-a -t %s -x %s %s" % (ddict[k][0], k[2], k[0]))
|
l.append("-a -t %s -x %s %s" % (ddict[k][0], k[2], k[0]))
|
||||||
else:
|
else:
|
||||||
|
@ -1557,11 +1556,10 @@ class ibpkeyRecords(semanageRecords):
|
||||||
keys = ddict.keys()
|
keys = ddict.keys()
|
||||||
if len(keys) == 0:
|
if len(keys) == 0:
|
||||||
return
|
return
|
||||||
keys.sort()
|
|
||||||
|
|
||||||
if heading:
|
if heading:
|
||||||
print("%-30s %-18s %s\n" % (_("SELinux IB Pkey Type"), _("Subnet_Prefix"), _("Pkey Number")))
|
print("%-30s %-18s %s\n" % (_("SELinux IB Pkey Type"), _("Subnet_Prefix"), _("Pkey Number")))
|
||||||
for i in keys:
|
for i in sorted(keys):
|
||||||
rec = "%-30s %-18s " % i
|
rec = "%-30s %-18s " % i
|
||||||
rec += "%s" % ddict[i][0]
|
rec += "%s" % ddict[i][0]
|
||||||
for p in ddict[i][1:]:
|
for p in ddict[i][1:]:
|
||||||
|
@ -1785,9 +1783,8 @@ class ibendportRecords(semanageRecords):
|
||||||
def customized(self):
|
def customized(self):
|
||||||
l = []
|
l = []
|
||||||
ddict = self.get_all(True)
|
ddict = self.get_all(True)
|
||||||
keys = ddict.keys()
|
|
||||||
keys.sort()
|
for k in sorted(ddict.keys()):
|
||||||
for k in keys:
|
|
||||||
l.append("-a -t %s -r %s -z %s %s" % (ddict[k][0], ddict[k][1], k[1], k[0]))
|
l.append("-a -t %s -r %s -z %s %s" % (ddict[k][0], ddict[k][1], k[1], k[0]))
|
||||||
return l
|
return l
|
||||||
|
|
||||||
|
@ -1796,11 +1793,10 @@ class ibendportRecords(semanageRecords):
|
||||||
keys = ddict.keys()
|
keys = ddict.keys()
|
||||||
if len(keys) == 0:
|
if len(keys) == 0:
|
||||||
return
|
return
|
||||||
keys.sort()
|
|
||||||
|
|
||||||
if heading:
|
if heading:
|
||||||
print("%-30s %-18s %s\n" % (_("SELinux IB End Port Type"), _("IB Device Name"), _("Port Number")))
|
print("%-30s %-18s %s\n" % (_("SELinux IB End Port Type"), _("IB Device Name"), _("Port Number")))
|
||||||
for i in keys:
|
for i in sorted(keys):
|
||||||
rec = "%-30s %-18s " % i
|
rec = "%-30s %-18s " % i
|
||||||
rec += "%s" % ddict[i][0]
|
rec += "%s" % ddict[i][0]
|
||||||
for p in ddict[i][1:]:
|
for p in ddict[i][1:]:
|
||||||
|
|
Loading…
Reference in New Issue