Blame SOURCES/0014-has_key-is-not-in-Python-3.patch

1070a0
From 769722facf088ea59ab010b363fc44d18b70d670 Mon Sep 17 00:00:00 2001
1070a0
From: Tomas Kasparek <tkasparek@redhat.com>
1070a0
Date: Mon, 5 Mar 2018 11:43:20 +0100
1070a0
Subject: [PATCH 14/17] has_key is not in Python 3
1070a0
1070a0
---
1070a0
 koan/app.py         | 14 +++++++-------
1070a0
 koan/utils.py       |  2 +-
1070a0
 koan/virtinstall.py |  4 ++--
1070a0
 koan/vmwcreate.py   |  4 ++--
1070a0
 4 files changed, 12 insertions(+), 12 deletions(-)
1070a0
1070a0
diff --git a/koan/app.py b/koan/app.py
1070a0
index f251c77..4ae4c90 100755
1070a0
--- a/koan/app.py
1070a0
+++ b/koan/app.py
1070a0
@@ -454,9 +454,9 @@ class Koan:
1070a0
     #---------------------------------------------------
1070a0
 
1070a0
     def safe_load(self,hashv,primary_key,alternate_key=None,default=None):
1070a0
-        if hashv.has_key(primary_key): 
1070a0
+        if primary_key in hashv:
1070a0
             return hashv[primary_key]
1070a0
-        elif alternate_key is not None and hashv.has_key(alternate_key):
1070a0
+        elif alternate_key is not None and alternate_key in hashv:
1070a0
             return hashv[alternate_key]
1070a0
         else:
1070a0
             return default
1070a0
@@ -524,7 +524,7 @@ class Koan:
1070a0
                 if profile_data.get("xml_file","") != "":
1070a0
                     raise InfoException("xmlfile based installations are not supported")
1070a0
 
1070a0
-                elif profile_data.has_key("file"):
1070a0
+                elif "file" in profile_data:
1070a0
                     print("- ISO or Image based installation, always uses --virt-type=qemu")
1070a0
                     self.virt_type = "qemu"
1070a0
                     
1070a0
@@ -661,7 +661,7 @@ class Koan:
1070a0
             raise InfoException("koan does not know how to list that")
1070a0
         data = self.get_data(what)
1070a0
         for x in data:
1070a0
-            if x.has_key("name"):
1070a0
+            if "name" in x:
1070a0
                 print(x["name"])
1070a0
         return True
1070a0
 
1070a0
@@ -670,7 +670,7 @@ class Koan:
1070a0
     def display(self):
1070a0
         def after_download(self, profile_data):
1070a0
             for x in DISPLAY_PARAMS:
1070a0
-                if profile_data.has_key(x):
1070a0
+                if x in profile_data:
1070a0
                     value = profile_data[x]
1070a0
                     if x == 'kernel_options':
1070a0
                         value = self.calc_kernel_args(profile_data)
1070a0
@@ -732,7 +732,7 @@ class Koan:
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
+            if "interfaces" in profile_data:
1070a0
                 url = pattern % (profile_data["http_server"],"system",profile_data["name"],dest)
1070a0
             else:
1070a0
                 url = pattern % (profile_data["http_server"],"profile",profile_data["name"],dest)
1070a0
@@ -1284,7 +1284,7 @@ class Koan:
1070a0
         if self.virt_name is not None:
1070a0
            # explicit override
1070a0
            name = self.virt_name
1070a0
-        elif profile_data.has_key("interfaces"):
1070a0
+        elif "interfaces" in profile_data:
1070a0
            # this is a system object, just use the name
1070a0
            name = profile_data["name"]
1070a0
         else:
1070a0
diff --git a/koan/utils.py b/koan/utils.py
1070a0
index 0cd48ea..12ec718 100644
1070a0
--- a/koan/utils.py
1070a0
+++ b/koan/utils.py
1070a0
@@ -206,7 +206,7 @@ def input_string_or_hash(options,delim=None,allow_multiples=True):
1070a0
                 new_dict[key] = value
1070a0
 
1070a0
         # dict.pop is not avail in 2.2
1070a0
-        if new_dict.has_key(""):
1070a0
+        if "" in new_dict:
1070a0
            del new_dict[""]
1070a0
         return new_dict
1070a0
     elif type(options) == type({}):
1070a0
diff --git a/koan/virtinstall.py b/koan/virtinstall.py
1070a0
index 2d1f3df..5359b2a 100644
1070a0
--- a/koan/virtinstall.py
1070a0
+++ b/koan/virtinstall.py
1070a0
@@ -233,7 +233,7 @@ def build_commandline(uri,
1070a0
             raise koan.InfoException("Profile 'file' required for image "
1070a0
                                      "install")
1070a0
 
1070a0
-    elif profile_data.has_key("file"):
1070a0
+    elif "file" in profile_data:
1070a0
         if is_xen:
1070a0
             raise koan.InfoException("Xen does not work with --image yet")
1070a0
 
1070a0
@@ -255,7 +255,7 @@ def build_commandline(uri,
1070a0
             floppy = utils.make_floppy(kickstart)
1070a0
     elif is_qemu or is_xen:
1070a0
         # images don't need to source this
1070a0
-        if not profile_data.has_key("install_tree"):
1070a0
+        if not "install_tree" in profile_data:
1070a0
             raise koan.InfoException("Cannot find install source in kickstart file, aborting.")
1070a0
 
1070a0
         if not profile_data["install_tree"].endswith("/"):
1070a0
diff --git a/koan/vmwcreate.py b/koan/vmwcreate.py
1070a0
index 82bfa4a..33c5819 100755
1070a0
--- a/koan/vmwcreate.py
1070a0
+++ b/koan/vmwcreate.py
1070a0
@@ -126,11 +126,11 @@ def start_install(name=None,
1070a0
                   virt_type=None,
1070a0
                   virt_auto_boot=False):
1070a0
 
1070a0
-    if profile_data.has_key("file"):
1070a0
+    if "file" in profile_data:
1070a0
         raise koan.InfoException("vmware does not work with --image yet")
1070a0
 
1070a0
     mac = None
1070a0
-    if not profile_data.has_key("interfaces"):
1070a0
+    if not "interfaces" in profile_data:
1070a0
         print("- vmware installation requires a system, not a profile")
1070a0
         return 1
1070a0
     for iname in profile_data["interfaces"]:
1070a0
-- 
1070a0
2.5.5
1070a0