Small 1.2.6 fixes
authorGuido Trotter <ultrotter@google.com>
Tue, 2 Sep 2008 15:39:01 +0000 (15:39 +0000)
committerGuido Trotter <ultrotter@google.com>
Tue, 2 Sep 2008 15:39:01 +0000 (15:39 +0000)
Found going through the 1.2.5/1.2.6~rc0 diff
  - Remove a slipped empty line
  - Change if statement to be more direct (nested if, rather than
    if...pass...elif)

Reviewed-by: iustinp

lib/cmdlib.py

index 67305f7..608937a 100644 (file)
@@ -2711,7 +2711,6 @@ class LUQueryInstances(NoHooksLU):
                        dynamic=self.dynamic_fields,
                        selected=self.op.output_fields)
 
-
     self.wanted = _GetWantedInstances(self, self.op.names)
 
   def Exec(self, feedback_fn):
@@ -2810,13 +2809,12 @@ class LUQueryInstances(NoHooksLU):
                        "hvm_cdrom_image_path", "hvm_nic_type",
                        "hvm_disk_type", "vnc_bind_address"):
           val = getattr(instance, field, None)
-          if val is not None:
-            pass
-          elif field in ("hvm_nic_type", "hvm_disk_type",
+          if val is None:
+            if field in ("hvm_nic_type", "hvm_disk_type",
                          "kernel_path", "initrd_path"):
-            val = "default"
-          else:
-            val = "-"
+              val = "default"
+            else:
+              val = "-"
         else:
           raise errors.ParameterError(field)
         iout.append(val)