[PATCH 2/2] Call getPossiblePhysicalExtents() only once

Vratislav Podzimek vpodzime at redhat.com
Thu May 15 12:59:08 UTC 2014


There's no need to call it twice and we can use a shorter name for the result.
Also get rid of unneeded square brackets in the join() call.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/kickstart.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index e9828fb..3f69019 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -1571,10 +1571,11 @@ class VolGroupData(commands.volgroup.F21_VolGroupData):
             self.pesize = LVM_PE_SIZE.convertTo(spec="KiB")
 
         pesize = Size("%d KiB" % self.pesize)
-        if pesize not in getPossiblePhysicalExtents():
+        possible_extents = getPossiblePhysicalExtents()
+        if pesize not in possible_extents:
             raise KickstartValueError(formatErrorMsg(self.lineno,
                     msg=_("Volume group given physical size of \"%(extentSize)s\", but must be one of:\n%(validExtentSizes)s.") %
-                         {"extentSize": pesize, "validExtentSizes": ", ".join([str(e) for e in getPossiblePhysicalExtents()])}))
+                                            {"extentSize": pesize, "validExtentSizes": ", ".join(str(e) for e in possible_extents)}))
 
         # If --noformat or --useexisting was given, there's really nothing to do.
         if not self.format or self.preexist:
-- 
1.9.0



More information about the anaconda-patches mailing list