Re: [PATCH anaconda-storage] Code fixes of errors shown by pylint

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

 



Hi,

Most of it looks good. A couple of comments inline, below.

> 
>  def getReleaseString(mountpoint):
> @@ -1062,7 +1062,6 @@ class CryptTab(object):
>                      except Exception:
>                          self.blkidTab = None
>  
> -                for line in lines:
>                      (line, pound, comment) = line.partition("#")
>                      fields = line.split()
>                      if not 2 <= len(fields) <= 4:

This is much more of a mess. See attached crypttab-parse.patch.

> diff --git a/storage/devicelibs/lvm.py b/storage/devicelibs/lvm.py
> index 52d9315..b43ef0a 100644
> --- a/storage/devicelibs/lvm.py
> +++ b/storage/devicelibs/lvm.py
<snip>
>  
> @@ -139,21 +140,20 @@ def safeLvmName(name):
>  def getVGUsedSpace(vgreq, requests, diskset):
>      vgused = 0
>      for request in requests.requests:
> -	if request.type == REQUEST_LV and request.volumeGroup == vgreq.uniqueID:
> -	    size = int(request.getActualSize(requests, diskset))
> -	    vgused = vgused + size
> -
> +        if request.type == REQUEST_LV and request.volumeGroup == vgreq.uniqueID:
> +            size = int(request.getActualSize(requests, diskset))
> +            vgused = vgused + size
>  
>      return vgused

This function should be removed completely.

>  
>  def getVGFreeSpace(vgreq, requests, diskset):
>      raise NotImplementedError
> -    used = getVGUsedSpace(vgreq, requests, diskset)
> -    log.debug("used space is %s" % (used,))
> -    
> -    total = vgreq.getActualSize(requests, diskset)
> -    log.debug("actual space is %s" % (total,))
> -    return total - used
> +    #used = getVGUsedSpace(vgreq, requests, diskset)
> +    #log.debug("used space is %s" % (used,))
> +    #
> +    #total = vgreq.getActualSize(requests, diskset)
> +    #log.debug("actual space is %s" % (total,))
> +    #return total - used

This function should also be removed.


The rest looks good.

Thanks for sorting it all out.

Dave
diff --git a/storage/__init__.py b/storage/__init__.py
index 940373d..828c5f3 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -1056,33 +1056,32 @@ class CryptTab(object):
         path = "%s/etc/crypttab" % chroot
         log.debug("parsing %s" % path)
         with open(path) as f:
+            if not self.blkidTab:
+                try:
+                    self.blkidTab = BlkidTab(chroot=chroot)
+                    self.blkidTab.parse()
+                except Exception:
+                    self.blkidTab = None
+
             for line in f.readlines():
-                if not self.blkidTab:
-                    try:
-                        self.blkidTab = BlkidTab(chroot=chroot)
-                        self.blkidTab.parse()
-                    except Exception:
-                        self.blkidTab = None
-
-                for line in lines:
-                    (line, pound, comment) = line.partition("#")
-                    fields = line.split()
-                    if not 2 <= len(fields) <= 4:
-                        continue
-                    elif len(fields) == 2:
-                        fields.extend(['none', ''])
-                    elif len(fields) == 3:
-                        fields.append('')
-
-                    (name, devspec, keyfile, options) = fields
-
-                    # resolve devspec to a device in the tree
-                    device = self.devicetree.resolveDevice(devspec,
-                                                           blkidTab=self.blkidTab)
-                    if device:
-                        self.mappings[name] = {"device": device,
-                                               "keyfile": keyfile,
-                                               "options": options}
+                (line, pound, comment) = line.partition("#")
+                fields = line.split()
+                if not 2 <= len(fields) <= 4:
+                    continue
+                elif len(fields) == 2:
+                    fields.extend(['none', ''])
+                elif len(fields) == 3:
+                    fields.append('')
+
+                (name, devspec, keyfile, options) = fields
+
+                # resolve devspec to a device in the tree
+                device = self.devicetree.resolveDevice(devspec,
+                                                       blkidTab=self.blkidTab)
+                if device:
+                    self.mappings[name] = {"device": device,
+                                           "keyfile": keyfile,
+                                           "options": options}
 
     def populate(self):
         """ Populate the instance based on the device tree's contents. """
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

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