Blame SOURCES/0004-Python-3-compatible-prints.patch

1070a0
From d045ccd1730c6211252cd68cd69d387895df9641 Mon Sep 17 00:00:00 2001
1070a0
From: Tomas Kasparek <tkasparek@redhat.com>
1070a0
Date: Mon, 5 Mar 2018 11:15:58 +0100
1070a0
Subject: [PATCH 04/17] Python 3 compatible prints
1070a0
1070a0
---
1070a0
 koan/app.py         | 106 ++++++++++++++++++++++++++--------------------------
1070a0
 koan/register.py    |  24 ++++++------
1070a0
 koan/utils.py       |  36 +++++++++---------
1070a0
 koan/virtinstall.py |  12 +++---
1070a0
 koan/vmwcreate.py   |  22 +++++------
1070a0
 5 files changed, 100 insertions(+), 100 deletions(-)
1070a0
1070a0
diff --git a/koan/app.py b/koan/app.py
1070a0
index e4e8a6d..ce8c8c3 100755
1070a0
--- a/koan/app.py
1070a0
+++ b/koan/app.py
1070a0
@@ -217,11 +217,11 @@ def main():
1070a0
         (xa, xb, tb) = sys.exc_info()
1070a0
         try:
1070a0
             getattr(e,"from_koan")
1070a0
-            print str(e)[1:-1] # nice exception, no traceback needed
1070a0
+            print(str(e)[1:-1]) # nice exception, no traceback needed
1070a0
         except:
1070a0
-            print xa
1070a0
-            print xb
1070a0
-            print string.join(traceback.format_list(traceback.extract_tb(tb)))
1070a0
+            print(xa)
1070a0
+            print(xb)
1070a0
+            print(string.join(traceback.format_list(traceback.extract_tb(tb))))
1070a0
         return 1
1070a0
 
1070a0
     return 0
1070a0
@@ -307,9 +307,9 @@ class Koan:
1070a0
     
1070a0
         if not os.getuid() == 0:
1070a0
             if self.is_virt:
1070a0
-                print "warning: running as non root"
1070a0
+                print("warning: running as non root")
1070a0
             else:
1070a0
-                print "this operation requires root access"
1070a0
+                print("this operation requires root access")
1070a0
                 return 3
1070a0
         
1070a0
         # if both --profile and --system were ommitted, autodiscover
1070a0
@@ -372,20 +372,20 @@ class Koan:
1070a0
         try:
1070a0
             available_profiles = self.xmlrpc_server.get_profiles()
1070a0
         except:
1070a0
-            traceback.print_exc()
1070a0
+            traceback.print(_exc())
1070a0
             self.connect_fail()
1070a0
 
1070a0
-        print "\n- which profile to install?\n"
1070a0
+        print("\n- which profile to install?\n")
1070a0
       
1070a0
         for x in available_profiles:
1070a0
-            print "%s" % x["name"]
1070a0
+            print("%s" % x["name"])
1070a0
 
1070a0
         sys.stdout.write("\n?>")
1070a0
 
1070a0
         data = sys.stdin.readline().strip()
1070a0
  
1070a0
         for x in available_profiles:
1070a0
-            print "comp (%s,%s)" % (x["name"],data)
1070a0
+            print("comp (%s,%s)" % (x["name"],data))
1070a0
             if x["name"] == data:
1070a0
                 return data
1070a0
         return None
1070a0
@@ -432,7 +432,7 @@ class Koan:
1070a0
             else:
1070a0
                 return None
1070a0
         elif len(detected_systems) == 1:
1070a0
-            print "- Auto detected: %s" % detected_systems[0]
1070a0
+            print("- Auto detected: %s" % detected_systems[0])
1070a0
             return detected_systems[0]
1070a0
 
1070a0
     #---------------------------------------------------
1070a0
@@ -509,7 +509,7 @@ class Koan:
1070a0
                     raise InfoException("xmlfile based installations are not supported")
1070a0
 
1070a0
                 elif profile_data.has_key("file"):
1070a0
-                    print "- ISO or Image based installation, always uses --virt-type=qemu"
1070a0
+                    print("- ISO or Image based installation, always uses --virt-type=qemu")
1070a0
                     self.virt_type = "qemu"
1070a0
                     
1070a0
                 else:
1070a0
@@ -525,7 +525,7 @@ class Koan:
1070a0
                         # assume Xen, we'll check to see if virt-type is really usable later.
1070a0
                         raise InfoException, "Not running a Xen kernel and qemu is not installed"
1070a0
 
1070a0
-                print "- no virt-type specified, auto-selecting %s" % self.virt_type
1070a0
+                print("- no virt-type specified, auto-selecting %s" % self.virt_type)
1070a0
 
1070a0
             # now that we've figured out our virt-type, let's see if it is really usable
1070a0
             # rather than showing obscure error messages from Xen to the user :)
1070a0
@@ -628,9 +628,9 @@ class Koan:
1070a0
                         break
1070a0
 
1070a0
             if self.safe_load(profile_data,"install_tree"):
1070a0
-                print "install_tree:", profile_data["install_tree"]
1070a0
+                print("install_tree:", profile_data["install_tree"])
1070a0
             else:
1070a0
-                print "warning: kickstart found but no install_tree found"
1070a0
+                print("warning: kickstart found but no install_tree found")
1070a0
                         
1070a0
         except:
1070a0
             # unstable to download the kickstart, however this might not
1070a0
@@ -646,7 +646,7 @@ class Koan:
1070a0
         data = self.get_data(what)
1070a0
         for x in data:
1070a0
             if x.has_key("name"):
1070a0
-                print x["name"]
1070a0
+                print(x["name"])
1070a0
         return True
1070a0
 
1070a0
     #---------------------------------------------------
1070a0
@@ -658,7 +658,7 @@ class Koan:
1070a0
                     value = profile_data[x]
1070a0
                     if x == 'kernel_options':
1070a0
                         value = self.calc_kernel_args(profile_data)
1070a0
-                    print "%20s  : %s" % (x, value)
1070a0
+                    print("%20s  : %s" % (x, value))
1070a0
         return self.net_install(after_download)
1070a0
 
1070a0
     #---------------------------------------------------
1070a0
@@ -702,9 +702,9 @@ class Koan:
1070a0
         template_files = utils.input_string_or_hash(template_files)
1070a0
         template_keys  = template_files.keys()
1070a0
 
1070a0
-        print "- template map: %s" % template_files
1070a0
+        print("- template map: %s" % template_files)
1070a0
 
1070a0
-        print "- processing for files to download..."
1070a0
+        print("- processing for files to download...")
1070a0
         for src in template_keys: 
1070a0
             dest = template_files[src]
1070a0
             save_as = dest
1070a0
@@ -713,7 +713,7 @@ class Koan:
1070a0
             if not save_as.startswith("/"):
1070a0
                 # this is a file in the template system that is not to be downloaded
1070a0
                 continue
1070a0
-            print "- file: %s" % save_as
1070a0
+            print("- file: %s" % save_as)
1070a0
 
1070a0
             pattern = "http://%s/cblr/svc/op/template/%s/%s/path/%s"
1070a0
             if profile_data.has_key("interfaces"):
1070a0
@@ -780,7 +780,7 @@ class Koan:
1070a0
                 '--command-line=%s' % (k_args,),
1070a0
                 self.safe_load(profile_data,'kernel_local')
1070a0
             ])
1070a0
-            print "Kernel loaded; run 'kexec -e' to execute"
1070a0
+            print("Kernel loaded; run 'kexec -e' to execute")
1070a0
         return self.net_install(after_download)
1070a0
 
1070a0
 
1070a0
@@ -900,25 +900,25 @@ class Koan:
1070a0
             # Any post-grubby processing required (e.g. ybin, zipl, lilo)?
1070a0
             if arch.startswith("ppc") and "grub2" not in probe_output:
1070a0
                 # FIXME - CHRP hardware uses a 'PPC PReP Boot' partition and doesn't require running ybin
1070a0
-                print "- applying ybin changes"
1070a0
+                print("- applying ybin changes")
1070a0
                 cmd = [ "/sbin/ybin" ]
1070a0
                 utils.subprocess_call(cmd)
1070a0
             elif arch.startswith("s390"):
1070a0
-                print "- applying zipl changes"
1070a0
+                print("- applying zipl changes")
1070a0
                 cmd = [ "/sbin/zipl" ]
1070a0
                 utils.subprocess_call(cmd)
1070a0
             else:
1070a0
                 # if grubby --bootloader-probe returns lilo,
1070a0
                 #    apply lilo changes
1070a0
                 if boot_probe_ret_code == 0 and string.find(probe_output, "lilo") != -1:
1070a0
-                    print "- applying lilo changes"
1070a0
+                    print("- applying lilo changes")
1070a0
                     cmd = [ "/sbin/lilo" ]
1070a0
                     utils.subprocess_call(cmd)
1070a0
 
1070a0
             if not self.add_reinstall_entry:
1070a0
-                print "- reboot to apply changes"
1070a0
+                print("- reboot to apply changes")
1070a0
             else:
1070a0
-                print "- reinstallation entry added"
1070a0
+                print("- reinstallation entry added")
1070a0
 
1070a0
         return self.net_install(after_download)
1070a0
 
1070a0
@@ -986,7 +986,7 @@ class Koan:
1070a0
             else:
1070a0
                 data = getattr(self.xmlrpc_server, "get_%s_for_koan" % what)(name)
1070a0
         except:
1070a0
-            traceback.print_exc()
1070a0
+            traceback.print(_exc())
1070a0
             self.connect_fail()
1070a0
         if data == {}:
1070a0
             raise InfoException("No entry/entries found")
1070a0
@@ -1049,15 +1049,15 @@ class Koan:
1070a0
                 initrd = "http://%s/cobbler/images/%s/%s" % (self.server, distro, initrd_short)
1070a0
 
1070a0
         try:
1070a0
-            print "downloading initrd %s to %s" % (initrd_short, initrd_save)
1070a0
-            print "url=%s" % initrd
1070a0
+            print("downloading initrd %s to %s" % (initrd_short, initrd_save))
1070a0
+            print("url=%s" % initrd)
1070a0
             utils.urlgrab(initrd,initrd_save)
1070a0
 
1070a0
-            print "downloading kernel %s to %s" % (kernel_short, kernel_save)
1070a0
-            print "url=%s" % kernel
1070a0
+            print("downloading kernel %s to %s" % (kernel_short, kernel_save))
1070a0
+            print("url=%s" % kernel)
1070a0
             utils.urlgrab(kernel,kernel_save)
1070a0
         except:
1070a0
-            traceback.print_exc()
1070a0
+            traceback.print(_exc())
1070a0
             raise InfoException, "error downloading files"
1070a0
         profile_data['kernel_local'] = kernel_save
1070a0
         profile_data['initrd_local'] = initrd_save
1070a0
@@ -1166,11 +1166,11 @@ class Koan:
1070a0
                 noreboot          =  self.virtinstall_noreboot,
1070a0
         )
1070a0
 
1070a0
-        print results
1070a0
+        print(results)
1070a0
 
1070a0
         if can_poll is not None and self.should_poll:
1070a0
             import libvirt
1070a0
-            print "- polling for virt completion"
1070a0
+            print("- polling for virt completion")
1070a0
             conn = None
1070a0
             if can_poll == "xen":
1070a0
                conn = libvirt.open(None)
1070a0
@@ -1183,14 +1183,14 @@ class Koan:
1070a0
                time.sleep(3)
1070a0
                state = utils.get_vm_state(conn, virtname)
1070a0
                if state == "running":
1070a0
-                   print "- install is still running, sleeping for 1 minute (%s)" % ct
1070a0
+                   print("- install is still running, sleeping for 1 minute (%s)" % ct)
1070a0
                    ct = ct + 1
1070a0
                    time.sleep(60)
1070a0
                elif state == "crashed":
1070a0
-                   print "- the install seems to have crashed."
1070a0
+                   print("- the install seems to have crashed.")
1070a0
                    return "failed"
1070a0
                elif state == "shutdown":
1070a0
-                   print "- shutdown VM detected, is the install done?  Restarting!"
1070a0
+                   print("- shutdown VM detected, is the install done?  Restarting!")
1070a0
                    utils.find_vm(conn, virtname).create()    
1070a0
                    return results
1070a0
                else:
1070a0
@@ -1202,7 +1202,7 @@ class Koan:
1070a0
             elif self.virt_type == "qemu":
1070a0
                utils.libvirt_enable_autostart(virtname)
1070a0
             else:
1070a0
-                print "- warning: don't know how to autoboot this virt type yet"
1070a0
+                print("- warning: don't know how to autoboot this virt type yet")
1070a0
             # else...
1070a0
         return results
1070a0
 
1070a0
@@ -1255,8 +1255,8 @@ class Koan:
1070a0
             disks.append([path,size])
1070a0
             counter = counter + 1
1070a0
         if len(disks) == 0:
1070a0
-            print "paths: ", paths
1070a0
-            print "sizes: ", sizes
1070a0
+            print("paths: ", paths)
1070a0
+            print("sizes: ", sizes)
1070a0
             raise InfoException, "Disk configuration not resolvable!"
1070a0
         return disks
1070a0
 
1070a0
@@ -1320,7 +1320,7 @@ class Koan:
1070a0
         if size is None or size == '':
1070a0
             err = True
1070a0
         if err:
1070a0
-            print "invalid file size specified, using defaults"
1070a0
+            print("invalid file size specified, using defaults")
1070a0
             return default_filesize
1070a0
         return int(size)
1070a0
 
1070a0
@@ -1339,7 +1339,7 @@ class Koan:
1070a0
         if size is None or size == '' or int(size) < default_ram:
1070a0
             err = True
1070a0
         if err:
1070a0
-            print "invalid RAM size specified, using defaults."
1070a0
+            print("invalid RAM size specified, using defaults.")
1070a0
             return default_ram
1070a0
         return int(size)
1070a0
 
1070a0
@@ -1353,7 +1353,7 @@ class Koan:
1070a0
         try:
1070a0
             isize = int(size)
1070a0
         except:
1070a0
-            traceback.print_exc()
1070a0
+            traceback.print(_exc())
1070a0
             return default_cpus
1070a0
         return isize
1070a0
 
1070a0
@@ -1386,7 +1386,7 @@ class Koan:
1070a0
         if my_id is None or my_id == '' or not uuid_re.match(id):
1070a0
             err = True
1070a0
         if err and my_id is not None:
1070a0
-            print "invalid UUID specified.  randomizing..."
1070a0
+            print("invalid UUID specified.  randomizing...")
1070a0
             return None
1070a0
         return my_id
1070a0
 
1070a0
@@ -1415,7 +1415,7 @@ class Koan:
1070a0
            else:
1070a0
                prefix = "/var/lib/vmware/images/"
1070a0
            if not os.path.exists(prefix):
1070a0
-               print "- creating: %s" % prefix
1070a0
+               print("- creating: %s" % prefix)
1070a0
                os.makedirs(prefix)
1070a0
            return [ "%s/%s-disk0" % (prefix, name) ]
1070a0
 
1070a0
@@ -1456,7 +1456,7 @@ class Koan:
1070a0
             elif not os.path.exists(location) and os.path.isdir(os.path.dirname(location)):
1070a0
                 return location
1070a0
             elif not os.path.exists(os.path.dirname(location)):
1070a0
-                print "- creating: %s" % os.path.dirname(location)
1070a0
+                print("- creating: %s" % os.path.dirname(location))
1070a0
                 os.makedirs(os.path.dirname(location))
1070a0
                 return location
1070a0
             else:
1070a0
@@ -1470,21 +1470,21 @@ class Koan:
1070a0
         else:
1070a0
             # it's a volume group, verify that it exists
1070a0
             args = "vgs -o vg_name"
1070a0
-            print "%s" % args
1070a0
+            print("%s" % args)
1070a0
             vgnames = sub_process.Popen(args, shell=True, stdout=sub_process.PIPE).communicate()[0]
1070a0
-            print vgnames
1070a0
+            print(vgnames)
1070a0
 
1070a0
             if vgnames.find(location) == -1:
1070a0
                 raise InfoException, "The volume group [%s] does not exist." % location
1070a0
             
1070a0
             # check free space
1070a0
             args = "LANG=C vgs --noheadings -o vg_free --units g %s" % location
1070a0
-            print args
1070a0
+            print(args)
1070a0
             cmd = sub_process.Popen(args, stdout=sub_process.PIPE, shell=True)
1070a0
             freespace_str = cmd.communicate()[0]
1070a0
             freespace_str = freespace_str.split("\n")[0].strip()
1070a0
             freespace_str = freespace_str.lower().replace("g","") # remove gigabytes
1070a0
-            print "(%s)" % freespace_str
1070a0
+            print("(%s)" % freespace_str)
1070a0
             freespace = int(float(freespace_str))
1070a0
 
1070a0
             virt_size = self.calc_virt_filesize(pd)
1070a0
@@ -1498,16 +1498,16 @@ class Koan:
1070a0
             
1070a0
                 # look for LVM partition named foo, create if doesn't exist
1070a0
                 args = "lvs -o lv_name %s" % location
1070a0
-                print "%s" % args
1070a0
+                print("%s" % args)
1070a0
                 lvs_str=sub_process.Popen(args, stdout=sub_process.PIPE, shell=True).communicate()[0]
1070a0
-                print lvs_str
1070a0
+                print(lvs_str)
1070a0
          
1070a0
                 name = "%s-disk%s" % (name,offset)
1070a0
  
1070a0
                 # have to create it?
1070a0
                 if lvs_str.find(name) == -1:
1070a0
                     args = "lvcreate -L %sG -n %s %s" % (virt_size, name, location)
1070a0
-                    print "%s" % args
1070a0
+                    print("%s" % args)
1070a0
                     lv_create = sub_process.call(args, shell=True)
1070a0
                     if lv_create != 0:
1070a0
                         raise InfoException, "LVM creation failed"
1070a0
diff --git a/koan/register.py b/koan/register.py
1070a0
index cabd4a6..1157e5c 100755
1070a0
--- a/koan/register.py
1070a0
+++ b/koan/register.py
1070a0
@@ -65,7 +65,7 @@ def main():
1070a0
 
1070a0
     (options, args) = p.parse_args()
1070a0
     #if not os.getuid() == 0:
1070a0
-    #    print "koan requires root access"
1070a0
+    #    print("koan requires root access")
1070a0
     #    return 3
1070a0
 
1070a0
     try:
1070a0
@@ -80,11 +80,11 @@ def main():
1070a0
         (xa, xb, tb) = sys.exc_info()
1070a0
         try:
1070a0
             getattr(e,"from_koan")
1070a0
-            print str(e)[1:-1] # nice exception, no traceback needed
1070a0
+            print(str(e)[1:-1]) # nice exception, no traceback needed
1070a0
         except:
1070a0
-            print xa
1070a0
-            print xb
1070a0
-            print string.join(traceback.format_list(traceback.extract_tb(tb)))
1070a0
+            print(xa)
1070a0
+            print(xb)
1070a0
+            print(string.join(traceback.format_list(traceback.extract_tb(tb))))
1070a0
         return 1
1070a0
 
1070a0
     return 0
1070a0
@@ -127,13 +127,13 @@ class Register:
1070a0
         if os.getuid() != 0:
1070a0
            raise InfoException("root access is required to register")
1070a0
  
1070a0
-        print "- preparing to koan home"
1070a0
+        print("- preparing to koan home")
1070a0
         self.conn = utils.connect_to_server(self.server, self.port)
1070a0
         reg_info = {}
1070a0
-        print "- gathering network info"
1070a0
+        print("- gathering network info")
1070a0
         netinfo = utils.get_network_info()
1070a0
         reg_info["interfaces"] = netinfo
1070a0
-        print "- checking hostname"
1070a0
+        print("- checking hostname")
1070a0
         sysname = ""
1070a0
         if self.hostname != "" and self.hostname != "*AUTO*":
1070a0
             hostname = self.hostname
1070a0
@@ -171,14 +171,14 @@ class Register:
1070a0
 
1070a0
         if not self.batch:
1070a0
             self.conn.register_new_system(reg_info)
1070a0
-            print "- registration successful, new system name: %s" % sysname
1070a0
+            print("- registration successful, new system name: %s" % sysname)
1070a0
         else:
1070a0
             try:
1070a0
                 self.conn.register_new_system(reg_info)
1070a0
-                print "- registration successful, new system name: %s" % sysname
1070a0
+                print("- registration successful, new system name: %s" % sysname)
1070a0
             except:
1070a0
-                traceback.print_exc()
1070a0
-                print "- registration failed, ignoring because of --batch"
1070a0
+                traceback.print(_exc())
1070a0
+                print("- registration failed, ignoring because of --batch")
1070a0
 
1070a0
         return
1070a0
    
1070a0
diff --git a/koan/utils.py b/koan/utils.py
1070a0
index b8247e2..77d53b2 100644
1070a0
--- a/koan/utils.py
1070a0
+++ b/koan/utils.py
1070a0
@@ -90,7 +90,7 @@ def urlread(url):
1070a0
     parts of urlread and urlgrab from urlgrabber, in ways that
1070a0
     are less cool and less efficient.
1070a0
     """
1070a0
-    print "- reading URL: %s" % url
1070a0
+    print("- reading URL: %s" % url)
1070a0
     if url is None or url == "":
1070a0
         raise InfoException, "invalid URL: %s" % url
1070a0
 
1070a0
@@ -109,7 +109,7 @@ def urlread(url):
1070a0
             subprocess_call(cmd)
1070a0
             return data
1070a0
         except:
1070a0
-            traceback.print_exc()
1070a0
+            traceback.print(_exc())
1070a0
             raise InfoException, "Couldn't mount and read URL: %s" % url
1070a0
           
1070a0
     elif url[0:4] == "http":
1070a0
@@ -119,7 +119,7 @@ def urlread(url):
1070a0
             fd.close()
1070a0
             return data
1070a0
         except:
1070a0
-            traceback.print_exc()
1070a0
+            traceback.print(_exc())
1070a0
             raise InfoException, "Couldn't download: %s" % url
1070a0
     elif url[0:4] == "file":
1070a0
         try:
1070a0
@@ -147,7 +147,7 @@ def subprocess_call(cmd,ignore_rc=0):
1070a0
     """
1070a0
     Wrapper around subprocess.call(...)
1070a0
     """
1070a0
-    print "- %s" % cmd
1070a0
+    print("- %s" % cmd)
1070a0
     rc = sub_process.call(cmd)
1070a0
     if rc != 0 and not ignore_rc:
1070a0
         raise InfoException, "command failed (%s)" % rc
1070a0
@@ -157,7 +157,7 @@ def subprocess_get_response(cmd, ignore_rc=False):
1070a0
     """
1070a0
     Wrapper around subprocess.check_output(...)
1070a0
     """
1070a0
-    print "- %s" % cmd
1070a0
+    print("- %s" % cmd)
1070a0
     rc = 0
1070a0
     result = ""
1070a0
     p = sub_process.Popen(cmd, stdout=sub_process.PIPE, stderr=sub_process.STDOUT)
1070a0
@@ -219,7 +219,7 @@ def input_string_or_hash(options,delim=None,allow_multiples=True):
1070a0
 
1070a0
 def hash_to_string(hash):
1070a0
     """
1070a0
-    Convert a hash to a printable string.
1070a0
+    Convert a hash to a print(able string.)
1070a0
     used primarily in the kernel options string
1070a0
     and for some legacy stuff where koan expects strings
1070a0
     (though this last part should be changed to hashes)
1070a0
@@ -232,7 +232,7 @@ def hash_to_string(hash):
1070a0
        if value is None:
1070a0
            buffer = buffer + str(key) + " "
1070a0
        elif type(value) == list:
1070a0
-           # this value is an array, so we print out every
1070a0
+           # this value is an array, so we print(out every)
1070a0
            # key=value
1070a0
            for item in value:
1070a0
               buffer = buffer + str(key) + "=" + str(item) + " "
1070a0
@@ -251,14 +251,14 @@ def nfsmount(input_path):
1070a0
     mount_cmd = [
1070a0
          "/bin/mount", "-t", "nfs", "-o", "ro", dirpath, tempdir
1070a0
     ]
1070a0
-    print "- running: %s" % mount_cmd
1070a0
+    print("- running: %s" % mount_cmd)
1070a0
     rc = sub_process.call(mount_cmd)
1070a0
     if not rc == 0:
1070a0
         shutil.rmtree(tempdir, ignore_errors=True)
1070a0
         raise koan.InfoException("nfs mount failed: %s" % dirpath)
1070a0
     # NOTE: option for a blocking install might be nice, so we could do this
1070a0
     # automatically, if supported by virt-install
1070a0
-    print "after install completes, you may unmount and delete %s" % tempdir
1070a0
+    print("after install completes, you may unmount and delete %s" % tempdir)
1070a0
     return (tempdir, filename)
1070a0
 
1070a0
 
1070a0
@@ -411,7 +411,7 @@ def get_network_info():
1070a0
          "module"      : module
1070a0
       }
1070a0
 
1070a0
-   # print interfaces
1070a0
+   # print(interfaces)
1070a0
    return interfaces
1070a0
 
1070a0
 def connect_to_server(server=None,port=None):
1070a0
@@ -431,7 +431,7 @@ def connect_to_server(server=None,port=None):
1070a0
         "https://%s/cobbler_api" % (server),
1070a0
     ]
1070a0
     for url in try_urls:
1070a0
-        print "- looking for Cobbler at %s" % url
1070a0
+        print("- looking for Cobbler at %s" % url)
1070a0
         server = __try_connect(url)
1070a0
         if server is not None:
1070a0
            return server
1070a0
@@ -467,18 +467,18 @@ def libvirt_enable_autostart(domain_name):
1070a0
 def make_floppy(kickstart):
1070a0
 
1070a0
     (fd, floppy_path) = tempfile.mkstemp(suffix='.floppy', prefix='tmp', dir="/tmp")
1070a0
-    print "- creating floppy image at %s" % floppy_path
1070a0
+    print("- creating floppy image at %s" % floppy_path)
1070a0
 
1070a0
     # create the floppy image file
1070a0
     cmd = "dd if=/dev/zero of=%s bs=1440 count=1024" % floppy_path
1070a0
-    print "- %s" % cmd
1070a0
+    print("- %s" % cmd)
1070a0
     rc = os.system(cmd)
1070a0
     if not rc == 0:
1070a0
         raise InfoException("dd failed")
1070a0
 
1070a0
     # vfatify
1070a0
     cmd = "mkdosfs %s" % floppy_path
1070a0
-    print "- %s" % cmd
1070a0
+    print("- %s" % cmd)
1070a0
     rc = os.system(cmd)
1070a0
     if not rc == 0:
1070a0
         raise InfoException("mkdosfs failed")
1070a0
@@ -486,19 +486,19 @@ def make_floppy(kickstart):
1070a0
     # mount the floppy
1070a0
     mount_path = tempfile.mkdtemp(suffix=".mnt", prefix='tmp', dir="/tmp")
1070a0
     cmd = "mount -o loop -t vfat %s %s" % (floppy_path, mount_path)
1070a0
-    print "- %s" % cmd
1070a0
+    print("- %s" % cmd)
1070a0
     rc = os.system(cmd)
1070a0
     if not rc == 0:
1070a0
         raise InfoException("mount failed")
1070a0
 
1070a0
     # download the kickstart file onto the mounted floppy
1070a0
-    print "- downloading %s" % kickstart
1070a0
+    print("- downloading %s" % kickstart)
1070a0
     save_file = os.path.join(mount_path, "unattended.txt")
1070a0
     urlgrabber.urlgrab(kickstart,filename=save_file)
1070a0
 
1070a0
     # umount    
1070a0
     cmd = "umount %s" % mount_path
1070a0
-    print "- %s" % cmd
1070a0
+    print("- %s" % cmd)
1070a0
     rc = os.system(cmd)
1070a0
     if not rc == 0:
1070a0
         raise InfoException("umount failed")
1070a0
@@ -522,7 +522,7 @@ def __try_connect(url):
1070a0
         xmlrpc_server.ping()
1070a0
         return xmlrpc_server
1070a0
     except:
1070a0
-        traceback.print_exc()
1070a0
+        traceback.print(_exc())
1070a0
         return None
1070a0
 
1070a0
 
1070a0
diff --git a/koan/virtinstall.py b/koan/virtinstall.py
1070a0
index ca11e04..2d1f3df 100644
1070a0
--- a/koan/virtinstall.py
1070a0
+++ b/koan/virtinstall.py
1070a0
@@ -191,7 +191,7 @@ def build_commandline(uri,
1070a0
     oldstyle_accelerate = False
1070a0
 
1070a0
     if not virtinst_version:
1070a0
-        print ("- warning: old virt-install detected, a lot of features will be disabled")
1070a0
+        print(("- warning: old virt-install detected, a lot of features will be disabled"))
1070a0
         disable_autostart = True
1070a0
         disable_boot_opt = True
1070a0
         disable_virt_type = True
1070a0
@@ -239,7 +239,7 @@ def build_commandline(uri,
1070a0
 
1070a0
         # this is an image based installation
1070a0
         input_path = profile_data["file"]
1070a0
-        print "- using image location %s" % input_path
1070a0
+        print("- using image location %s" % input_path)
1070a0
         if input_path.find(":") == -1:
1070a0
             # this is not an NFS path
1070a0
             cdrom = input_path
1070a0
@@ -251,7 +251,7 @@ def build_commandline(uri,
1070a0
         if kickstart != "":
1070a0
             # we have a (windows?) answer file we have to provide
1070a0
             # to the ISO.
1070a0
-            print "I want to make a floppy for %s" % kickstart
1070a0
+            print("I want to make a floppy for %s" % kickstart)
1070a0
             floppy = utils.make_floppy(kickstart)
1070a0
     elif is_qemu or is_xen:
1070a0
         # images don't need to source this
1070a0
@@ -378,7 +378,7 @@ def build_commandline(uri,
1070a0
                 # compatibility in virt-install grumble grumble.
1070a0
                 cmd += "--os-variant %s" % os_version + ".0 "
1070a0
             else:
1070a0
-                print ("- warning: virt-install doesn't know this os_version, defaulting to generic26")
1070a0
+                print(("- warning: virt-install doesn't know this os_version, defaulting to generic26"))
1070a0
                 cmd += "--os-variant generic26 "
1070a0
         else:
1070a0
             distro = "unix"
1070a0
@@ -394,8 +394,8 @@ def build_commandline(uri,
1070a0
         cmd += "--disk path=%s " % importpath
1070a0
 
1070a0
     for path, size, driver_type in disks:
1070a0
-        print ("- adding disk: %s of size %s (driver type=%s)" %
1070a0
-               (path, size, driver_type))
1070a0
+        print(("- adding disk: %s of size %s (driver type=%s)" %
1070a0
+               (path, size, driver_type)))
1070a0
         cmd += "--disk path=%s" % (path)
1070a0
         if str(size) != "0":
1070a0
             cmd += ",size=%s" % size
1070a0
diff --git a/koan/vmwcreate.py b/koan/vmwcreate.py
1070a0
index 372173a..97e0ba2 100755
1070a0
--- a/koan/vmwcreate.py
1070a0
+++ b/koan/vmwcreate.py
1070a0
@@ -77,7 +77,7 @@ def random_mac():
1070a0
 
1070a0
 def make_disk(disksize,image):
1070a0
     cmd = "vmware-vdiskmanager -c -a lsilogic -s %sGb -t 0 %s" % (disksize, image)
1070a0
-    print "- %s" % cmd
1070a0
+    print("- %s" % cmd)
1070a0
     rc = os.system(cmd)
1070a0
     if rc != 0:
1070a0
        raise VirtCreateException("command failed")
1070a0
@@ -96,7 +96,7 @@ def make_vmx(path,vmdk_image,image_name,mac_address,memory):
1070a0
 
1070a0
 def register_vmx(vmx_file):
1070a0
     cmd = "vmware-cmd -s register %s" % vmx_file
1070a0
-    print "- %s" % cmd
1070a0
+    print("- %s" % cmd)
1070a0
     rc = os.system(cmd)
1070a0
     if rc!=0:
1070a0
        raise VirtCreateException("vmware registration failed")
1070a0
@@ -104,7 +104,7 @@ def register_vmx(vmx_file):
1070a0
 def start_vm(vmx_file):
1070a0
     os.chmod(vmx_file,0755)
1070a0
     cmd = "vmware-cmd %s start" % vmx_file
1070a0
-    print "- %s" % cmd
1070a0
+    print("- %s" % cmd)
1070a0
     rc = os.system(cmd)
1070a0
     if rc != 0:
1070a0
        raise VirtCreateException("vm start failed")
1070a0
@@ -129,19 +129,19 @@ def start_install(name=None,
1070a0
 
1070a0
     mac = None
1070a0
     if not profile_data.has_key("interfaces"):
1070a0
-        print "- vmware installation requires a system, not a profile"
1070a0
+        print("- vmware installation requires a system, not a profile")
1070a0
         return 1
1070a0
     for iname in profile_data["interfaces"]:
1070a0
         intf = profile_data["interfaces"][iname]
1070a0
         mac = intf["mac_address"]
1070a0
     if mac is None:
1070a0
-        print "- no MAC information available in this record, cannot install"
1070a0
+        print("- no MAC information available in this record, cannot install")
1070a0
         return 1
1070a0
 
1070a0
-    print "DEBUG: name=%s" % name
1070a0
-    print "DEBUG: ram=%s" % ram
1070a0
-    print "DEBUG: mac=%s" % mac
1070a0
-    print "DEBUG: disks=%s" % disks
1070a0
+    print("DEBUG: name=%s" % name)
1070a0
+    print("DEBUG: ram=%s" % ram)
1070a0
+    print("DEBUG: mac=%s" % mac)
1070a0
+    print("DEBUG: disks=%s" % disks)
1070a0
     # starts vmware using PXE.  disk/mem info come from Cobbler
1070a0
     # rest of the data comes from PXE which is also intended
1070a0
     # to be managed by Cobbler.
1070a0
@@ -158,10 +158,10 @@ def start_install(name=None,
1070a0
     disksize = disks[0][1]
1070a0
 
1070a0
     image = "%s/%s" % (IMAGE_DIR, name)
1070a0
-    print "- saving virt disk image as %s" % image
1070a0
+    print("- saving virt disk image as %s" % image)
1070a0
     make_disk(disksize,image)
1070a0
     vmx = "%s/%s" % (VMX_DIR, name)
1070a0
-    print "- saving vmx file as %s" % vmx
1070a0
+    print("- saving vmx file as %s" % vmx)
1070a0
     make_vmx(vmx,image,name,mac,ram)
1070a0
     register_vmx(vmx)
1070a0
     start_vm(vmx)
1070a0
-- 
1070a0
2.5.5
1070a0