[et-mgmt-tools] [patch 4/4] Remove the unused Guest.keymap property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The Guest keymap property turns out to be unused, the keymap
in the graphics property is what is actually used.

Remove the property and move the keymap validation into the
graphics property setter.

Signed-off-by: Mark McLoughlin <markmc@xxxxxxxxxx>

Index: virtinst--devel/virt-install
===================================================================
--- virtinst--devel.orig/virt-install
+++ virtinst--devel/virt-install
@@ -108,13 +108,6 @@ def get_vcpus(vcpus, check_cpu, guest, c
     if vcpus:
             guest.vcpus = vcpus
 
-def get_keymap(keymap, guest):
-    if keymap:
-        try:
-            guest.keymap = keymap
-        except ValueError, e:
-            print "ERROR: ", e
-
 def get_disk(disk, size, sparse, guest, hvm, conn):
     # FIXME: need to handle a list of disks at some point
     while 1:
@@ -534,7 +527,6 @@ def main():
     get_memory(options.memory, guest)
     get_uuid(options.uuid, guest)
     get_vcpus(options.vcpus, options.check_cpu, guest, conn)
-    get_keymap(options.keymap, guest)
 
     # set up disks
     get_disks(options.diskfile, options.disksize, options.sparse,
Index: virtinst--devel/virtinst/Guest.py
===================================================================
--- virtinst--devel.orig/virtinst/Guest.py
+++ virtinst--devel/virtinst/Guest.py
@@ -439,20 +439,6 @@ class Guest(object):
     vcpus = property(get_vcpus, set_vcpus)
 
 
-    # keymap for the guest
-    def get_keymap(self):
-        return self._keymap
-    def set_keymap(self, val):
-        if val and (re.match("^[a-zA-Z0-9_]*$", val) == None):
-            raise ValueError, "Keymap be alphanumeric or _"
-        if val and (len(val) > 16):
-            raise ValueError, "Keymap must be less than 16 characters"
-        if val and (type(val) != type("string")):
-            raise ValueError, "Keymap must be a string"
-        self._keymap = val
-    keymap = property(get_keymap, set_keymap)
-
-
     # kernel + initrd pair to use for installing as opposed to using a location
     def get_boot(self):
         return self._boot
@@ -512,6 +498,17 @@ class Guest(object):
     def get_graphics(self):
         return self._graphics
     def set_graphics(self, val):
+        def validate_keymap(keymap):
+            if not keymap:
+                return keymap
+            if type(keymap) != type("string"):
+                raise ValueError, "Keymap must be a string"
+            if len(keymap) > 16:
+                raise ValueError, "Keymap must be less than 16 characters"
+            if re.match("^[a-zA-Z0-9_]*$", keymap) == None:
+                raise ValueError, "Keymap be alphanumeric or _"
+            return keymap
+
         opts = None
         t = None
         if type(val) == dict:
@@ -526,7 +523,7 @@ class Guest(object):
             if len(val) >= 1: self._graphics["enabled"] = val[0]
             if len(val) >= 2: t = val[1]
             if len(val) >= 3: opts = val[2]
-            if len(val) >= 4: self._graphics["keymap"] = val[3]
+            if len(val) >= 4: self._graphics["keymap"] = validate_keymap(val[3])
         else:
             if val in ("vnc", "sdl"):
                 t = val

-- 


[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux