diff options
author | Martin Gracik <mgracik@redhat.com> | 2009-03-30 19:56:00 +0200 |
---|---|---|
committer | Martin Gracik <mgracik@redhat.com> | 2009-03-31 15:24:09 +0200 |
commit | 0f0d794130684465bbe21c08f26fc8d2fd37a952 (patch) | |
tree | 22c6688ef90b7d9a9df4baf03ee089e1fdb49d36 /storage | |
parent | b1a13d63d0544a2ab123a0405c80006df5feeaad (diff) | |
download | anaconda-0f0d794130684465bbe21c08f26fc8d2fd37a952.tar.gz anaconda-0f0d794130684465bbe21c08f26fc8d2fd37a952.tar.xz anaconda-0f0d794130684465bbe21c08f26fc8d2fd37a952.zip |
Fixes of errors shown by pylint that didn't get into the beta build.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/deviceaction.py | 7 | ||||
-rw-r--r-- | storage/devicelibs/crypto.py | 1 | ||||
-rw-r--r-- | storage/devicelibs/mdraid.py | 2 | ||||
-rw-r--r-- | storage/devicelibs/swap.py | 5 | ||||
-rw-r--r-- | storage/devicetree.py | 1 | ||||
-rw-r--r-- | storage/errors.py | 3 | ||||
-rw-r--r-- | storage/formats/__init__.py | 1 | ||||
-rw-r--r-- | storage/formats/dmraid.py | 2 | ||||
-rw-r--r-- | storage/formats/fs.py | 7 | ||||
-rw-r--r-- | storage/formats/lvmpv.py | 7 | ||||
-rw-r--r-- | storage/iscsi.py | 37 | ||||
-rw-r--r-- | storage/miscutils.py | 1 | ||||
-rw-r--r-- | storage/partitioning.py | 1 | ||||
-rw-r--r-- | storage/udev.py | 8 | ||||
-rw-r--r-- | storage/zfcp.py | 7 |
15 files changed, 33 insertions, 57 deletions
diff --git a/storage/deviceaction.py b/storage/deviceaction.py index ba4456a6e..b462108bb 100644 --- a/storage/deviceaction.py +++ b/storage/deviceaction.py @@ -22,7 +22,6 @@ # import copy -from parted import PARTITION_BOOT from udev import * @@ -37,10 +36,8 @@ import logging log = logging.getLogger("storage") -""" The values are just hints as to the ordering. - - Eg: fsmod and devmod ordering depends on the mod (shrink -v- grow) -""" +# The values are just hints as to the ordering. +# Eg: fsmod and devmod ordering depends on the mod (shrink -v- grow) ACTION_TYPE_NONE = 0 ACTION_TYPE_DESTROY = 1000 ACTION_TYPE_RESIZE = 500 diff --git a/storage/devicelibs/crypto.py b/storage/devicelibs/crypto.py index 28da47c54..771798a2a 100644 --- a/storage/devicelibs/crypto.py +++ b/storage/devicelibs/crypto.py @@ -23,7 +23,6 @@ import os from pycryptsetup import CryptSetup -import iutil from ..errors import * import gettext diff --git a/storage/devicelibs/mdraid.py b/storage/devicelibs/mdraid.py index 4aec86f7d..7d6ace2f4 100644 --- a/storage/devicelibs/mdraid.py +++ b/storage/devicelibs/mdraid.py @@ -42,7 +42,7 @@ def getRaidLevels(): avail = [] try: f = open("/proc/mdstat", "r") - except: + except IOError: pass else: for l in f.readlines(): diff --git a/storage/devicelibs/swap.py b/storage/devicelibs/swap.py index 090c92eed..dadeb0a0c 100644 --- a/storage/devicelibs/swap.py +++ b/storage/devicelibs/swap.py @@ -52,15 +52,16 @@ def swapon(device, priority=None): num = pagesize else: num = 2048 + try: fd = os.open(device, os.O_RDONLY) buf = os.read(fd, num) - except: + except OSError: pass finally: try: os.close(fd) - except: + except (OSError, UnboundLocalError): pass if buf is not None and len(buf) == pagesize: diff --git a/storage/devicetree.py b/storage/devicetree.py index de3847797..d87c5af4d 100644 --- a/storage/devicetree.py +++ b/storage/devicetree.py @@ -1392,7 +1392,6 @@ class DeviceTree(object): except DeviceError: # the pvremoves will finish the job. log.debug("There was an error destroying the VG %s." % vg.name) - pass # remove VG device from list. self._removeDevice(vg) diff --git a/storage/errors.py b/storage/errors.py index 8fb57b140..d2d35ee9a 100644 --- a/storage/errors.py +++ b/storage/errors.py @@ -18,9 +18,6 @@ class DeviceSetupError(DeviceError): class DeviceTeardownError(DeviceError): pass -class DeviceResizeError(DeviceError): - pass - class DeviceUserDeniedFormatError(DeviceError): pass diff --git a/storage/formats/__init__.py b/storage/formats/__init__.py index 9ec099932..784bb1c79 100644 --- a/storage/formats/__init__.py +++ b/storage/formats/__init__.py @@ -284,7 +284,6 @@ class DeviceFormat(object): def teardown(self, *args, **kwargs): log_method_call(self, device=self.device, type=self.type, status=self.status) - pass @property def status(self): diff --git a/storage/formats/dmraid.py b/storage/formats/dmraid.py index f5f28084a..4ebd41c70 100644 --- a/storage/formats/dmraid.py +++ b/storage/formats/dmraid.py @@ -20,8 +20,6 @@ # Red Hat Author(s): Dave Lehman <dlehman@redhat.com> # -import block - from iutil import log_method_call from ..errors import * from . import DeviceFormat, register_device_format diff --git a/storage/formats/fs.py b/storage/formats/fs.py index 474d8287e..cff52d3a4 100644 --- a/storage/formats/fs.py +++ b/storage/formats/fs.py @@ -664,10 +664,9 @@ class FS(DeviceFormat): return _type - """ These methods just wrap filesystem-specific methods in more - generically named methods so filesystems and formatted devices - like swap and LVM physical volumes can have a common API. - """ + # These methods just wrap filesystem-specific methods in more + # generically named methods so filesystems and formatted devices + # like swap and LVM physical volumes can have a common API. def create(self, *args, **kwargs): if self.exists: raise FSError("filesystem already exists") diff --git a/storage/formats/lvmpv.py b/storage/formats/lvmpv.py index c9cbe295d..a11163533 100644 --- a/storage/formats/lvmpv.py +++ b/storage/formats/lvmpv.py @@ -74,7 +74,6 @@ class LVMPhysicalVolume(DeviceFormat): if not self.exists: raise PhysicalVolumeError("format has not been created") - pass #info = lvm.pvinfo(self.device) #self.vgName = info['vg_name'] #self.vgUuid = info['vg_uuid'] @@ -84,9 +83,9 @@ class LVMPhysicalVolume(DeviceFormat): log_method_call(self, device=self.device, type=self.type, status=self.status) DeviceFormat.create(self, *args, **kwargs) - """ Consider use of -Z|--zero - -f|--force or -y|--yes may be required - """ + # Consider use of -Z|--zero + # -f|--force or -y|--yes may be required + # lvm has issues with persistence of metadata, so here comes the # hammer... DeviceFormat.destroy(self, *args, **kwargs) diff --git a/storage/iscsi.py b/storage/iscsi.py index 29d89830e..3e6dc0a32 100644 --- a/storage/iscsi.py +++ b/storage/iscsi.py @@ -20,11 +20,7 @@ from constants import * import os -import errno -import string -import signal import iutil -import isys from flags import flags import logging import shutil @@ -39,11 +35,10 @@ _ = lambda x: gettext.ldgettext("anaconda", x) has_libiscsi = True try: import libiscsi -except: +except ImportError: has_libiscsi = False # Note that stage2 copies all files under /sbin to /usr/sbin -global ISCSID ISCSID="" INITIATOR_FILE="/etc/iscsi/initiatorname.iscsi" @@ -141,19 +136,19 @@ class iscsi(object): return try: - found_nodes = libiscsi.discover_firmware() + found_nodes = libiscsi.discover_firmware() except: - # an exception here means there is no ibft firmware, just return - return + # an exception here means there is no ibft firmware, just return + return for node in found_nodes: try: - node.login() - self.nodes.append(node) + node.login() + self.nodes.append(node) except: - # FIXME, what to do when we cannot log in to a firmware - # provided node ?? - pass + # FIXME, what to do when we cannot log in to a firmware + # provided node ?? + pass stabilize(intf) @@ -234,14 +229,14 @@ class iscsi(object): found = found + 1 try: - if (authinfo): - node.setAuth(authinfo) - node.login() - self.nodes.append(node) - logged_in = logged_in + 1 + if (authinfo): + node.setAuth(authinfo) + node.login() + self.nodes.append(node) + logged_in = logged_in + 1 except: - # some nodes may require different credentials - pass + # some nodes may require different credentials + pass if intf: w.pop() diff --git a/storage/miscutils.py b/storage/miscutils.py index b9c9740f1..e57749777 100644 --- a/storage/miscutils.py +++ b/storage/miscutils.py @@ -1,5 +1,4 @@ # iutil.py stubs -import sys import os import logging diff --git a/storage/partitioning.py b/storage/partitioning.py index 50f1a68f5..d824fa6f5 100644 --- a/storage/partitioning.py +++ b/storage/partitioning.py @@ -22,7 +22,6 @@ import sys import os -import copy from operator import add, sub import parted diff --git a/storage/udev.py b/storage/udev.py index 49a6096dc..6a22a98b2 100644 --- a/storage/udev.py +++ b/storage/udev.py @@ -21,7 +21,6 @@ # import os -import re import stat import iutil @@ -170,9 +169,8 @@ def udev_trigger(subsystem=None): iutil.execWithRedirect("udevadm", argv, stderr="/dev/null", searchPath=1) -""" These are functions for retrieving specific pieces of information from - udev database entries. -""" +# These are functions for retrieving specific pieces of information from +# udev database entries. def udev_device_get_name(udev_info): """ Return the best name for a device based on the udev db data. """ return udev_info.get("DM_NAME", udev_info["name"]) @@ -313,7 +311,7 @@ def udev_device_is_dmraid(info): def udev_device_get_dmraid_partition_disk(info): try: p_index = info["DM_NAME"].rindex("p") - except: + except (KeyError, AttributeError, ValueError): return None if not info["DM_NAME"][p_index+1:].isdigit(): diff --git a/storage/zfcp.py b/storage/zfcp.py index e38b8186b..2584268ce 100644 --- a/storage/zfcp.py +++ b/storage/zfcp.py @@ -21,9 +21,6 @@ import string import os -import iutil -import isys -import shutil from constants import * import gettext @@ -94,7 +91,7 @@ class ZFCPDevice: try: int(hex, 16) return True - except: + except TypeError: return False def checkValidDevice(self, id): @@ -184,7 +181,7 @@ class ZFCP: def readConfig(self): try: f = open("/tmp/fcpconfig", "r") - except: + except IOError: log.info("no /tmp/fcpconfig; not configuring zfcp") return |