diff --git a/scripts/xe-scsi-dev-map b/scripts/xe-scsi-dev-map index c1832e0001..8b4a4db62b 100644 --- a/scripts/xe-scsi-dev-map +++ b/scripts/xe-scsi-dev-map @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # # Copyright (c) Citrix Systems 2008. All rights reserved. # @@ -14,7 +14,8 @@ def doexec(args, inputtext=None): proc = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - close_fds=True) + close_fds=True, + universal_newlines=True) (stdout, stderr) = proc.communicate(inputtext) retcode = proc.returncode return (retcode, stdout, stderr) @@ -58,7 +59,7 @@ def main(): retinfo = pread(command) index = retinfo.find(findser) if index != -1: - if idlist.has_key(retinfo[index+len(findser):len(retinfo)].strip()): + if retinfo[index+len(findser):len(retinfo)].strip() in idlist: idlist[retinfo[index+len(findser):len(retinfo)].strip()].append(filepath) else: idlist[retinfo[index+len(findser):len(retinfo)].strip()]=[filepath] @@ -80,7 +81,7 @@ def main(): retinfo = pread(command) index = retinfo.find(findser) if index != -1: - if idlist.has_key(retinfo[index+len(findser):len(retinfo)].strip()): + if retinfo[index+len(findser):len(retinfo)].strip() in idlist: idlist[retinfo[index+len(findser):len(retinfo)].strip()].append(filepath) else: idlist[retinfo[index+len(findser):len(retinfo)].strip()]=[filepath] @@ -100,7 +101,7 @@ def main(): retinfo = pread(command) index = retinfo.find(findser) if index != -1: - if idlist.has_key(retinfo[index+len(findser):len(retinfo)].strip()): + if retinfo[index+len(findser):len(retinfo)].strip() in idlist: idlist[retinfo[index+len(findser):len(retinfo)].strip()].append(filepath) else: idlist[retinfo[index+len(findser):len(retinfo)].strip()]=[filepath] @@ -110,11 +111,11 @@ def main(): pass for id in idlist: - print - print "serial number '%s' maps the following devices " % id + print() + print("serial number '%s' maps the following devices " % id) for mapping in idlist[id]: - print " %s" % mapping - print + print(" %s" % mapping) + print() if __name__ == "__main__": main()