From 8b6d7f89c7e90a33fc7c451f7a4be35d742d8979 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Jul 22 2011 15:59:49 +0000 Subject: Fix a bunch of stupid little errors pylint caught. --- diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py index 6df0107..ab89d51 100644 --- a/pyanaconda/bootloader.py +++ b/pyanaconda/bootloader.py @@ -869,7 +869,7 @@ class BootLoader(object): """Write password-related configuration lines.""" pass - def write_config_header(self, config): + def write_config_header(self, config, install_root=""): """Write global configuration lines.""" self.write_config_console(config) self.write_config_password(config) @@ -941,6 +941,9 @@ class BootLoader(object): self.stage2_device.format.sync(root=install_root) self.install(install_root=install_root) + def install(self, install_root=""): + raise NotImplementedError() + def update(self, install_root=""): """ Update an existing bootloader configuration. """ pass @@ -1640,7 +1643,7 @@ class Yaboot(YabootSILOBase): def config_file(self): return "%s/%s" % (self.config_dir, self._config_file) - def write_config_header(self, config): + def write_config_header(self, config, install_root=""): if self.stage2_device.type == "mdarray": boot_part_num = self.stage2_device.parents[0].partedPartition.number else: @@ -1773,10 +1776,10 @@ class ZIPL(BootLoader): "boot_dir": self.boot_dir}) config.write(stanza) - def write_config_header(self, config): + def write_config_header(self, config, install_root=""): header = ("[defaultboot]\n" - "timeout=%{timeout}d\n" - "default=%{default}\n" + "timeout=%(timeout)d\n" + "default=%(default)s\n" "target=/boot\n" % {"timeout": self.timeout, "default": self.image_label(self.default)}) @@ -1842,7 +1845,7 @@ class SILO(YabootSILOBase): f.close() os.chmod(message_file, 0600) - def write_config_header(self, config): + def write_config_header(self, config, install_root=""): header = ("# silo.conf generated by anaconda\n\n" "#boot=%(stage1dev)s\n" "message=%(message)s\n" @@ -1889,7 +1892,7 @@ class SILO(YabootSILOBase): raise BootLoaderError("bootloader install failed") -""" anaconda-specific functions """ +# anaconda-specific functions def writeSysconfigKernel(anaconda, default_kernel): f = open(anaconda.rootPath + "/etc/sysconfig/kernel", "w+") diff --git a/pyanaconda/cmdline.py b/pyanaconda/cmdline.py index 078dfb2..5b3e7a2 100644 --- a/pyanaconda/cmdline.py +++ b/pyanaconda/cmdline.py @@ -34,7 +34,7 @@ _ = lambda x: gettext.ldgettext("anaconda", x) import logging log = logging.getLogger("anaconda") -stepToClasses = { "install" : "setupProgressDisplay" } +stepToClasses = { "install" : setupProgressDisplay } class WaitWindow: def pop(self): @@ -168,9 +168,7 @@ class InstallInterface(InstallInterfaceBase): def display_step(self, step): if stepToClasses.has_key(step): - s = "nextWin = %s" %(stepToClasses[step],) - exec s - nextWin(self.anaconda) + stepToClasses[step](self.anaconda) else: print("In interactive step %s, can't continue" %(step,)) while 1: diff --git a/pyanaconda/installinterfacebase.py b/pyanaconda/installinterfacebase.py index af15a91..a34ae26 100644 --- a/pyanaconda/installinterfacebase.py +++ b/pyanaconda/installinterfacebase.py @@ -33,6 +33,9 @@ class InstallInterfaceBase(object): self._initLabelAnswers = {} self._inconsistentLVMAnswers = {} + def reinitializeWindow(self, title, path, size, description): + raise NotImplementedError + def messageWindow(self, title, text, type="ok", default = None, custom_buttons=None, custom_icon=None): raise NotImplementedError diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py index a2d76a4..e43af8c 100644 --- a/pyanaconda/iutil.py +++ b/pyanaconda/iutil.py @@ -961,7 +961,7 @@ def fork_orphan(): if os.fork(): # the intermediate child dies os._exit(0) - return 0; + return 0 # the original process waits for the intermediate child os.waitpid(intermediate, 0) return 1 diff --git a/pyanaconda/iw/osbootwidget.py b/pyanaconda/iw/osbootwidget.py index 09fd6fd..7d6764c 100644 --- a/pyanaconda/iw/osbootwidget.py +++ b/pyanaconda/iw/osbootwidget.py @@ -293,8 +293,8 @@ class OSBootWidget: self.editOther(image) def deleteEntry(self, widget, *args): - rc = self.getSelected() - if not rc: + image = self.getSelected() + if not image: return if image.device != self.storage.rootDevice: del self.images[image.device.name] diff --git a/pyanaconda/sshd.py b/pyanaconda/sshd.py index 8f1110c..05ba178 100644 --- a/pyanaconda/sshd.py +++ b/pyanaconda/sshd.py @@ -20,7 +20,7 @@ import logging -import os +import os, sys log = logging.getLogger("anaconda") import iutil diff --git a/pyanaconda/storage/devicelibs/crypto.py b/pyanaconda/storage/devicelibs/crypto.py index 134e67f..64b8bec 100644 --- a/pyanaconda/storage/devicelibs/crypto.py +++ b/pyanaconda/storage/devicelibs/crypto.py @@ -143,7 +143,7 @@ def luks_remove_key(device, raise ValueError("luks_remove_key requires passphrase") cs = CryptSetup(device=device, yesDialog = askyes, logFunc = dolog, passwordDialog = askpassphrase) - rc = cs.removePassphrase(passphrase = new_passphrase) + rc = cs.removePassphrase(passphrase = passphrase) if rc: raise CryptoError("luks remove key failed with errcode %d" % (rc,)) diff --git a/pyanaconda/storage/devicetree.py b/pyanaconda/storage/devicetree.py index 646f30b..5ecdc63 100644 --- a/pyanaconda/storage/devicetree.py +++ b/pyanaconda/storage/devicetree.py @@ -854,7 +854,7 @@ class DeviceTree(object): if not container_info: log.error("failed to find md container %s at %s" % (parentName, container_sysfs)) - return + return container = self.addUdevDevice(container_info) if not container: diff --git a/pyanaconda/storage/formats/__init__.py b/pyanaconda/storage/formats/__init__.py index 9a468b9..4b83604 100644 --- a/pyanaconda/storage/formats/__init__.py +++ b/pyanaconda/storage/formats/__init__.py @@ -58,7 +58,7 @@ def get_default_filesystem_type(): if supported: return fstype - raise DeviceFormatError("None of %s is supported by your kernel" % ",".join(fstypes)) + raise DeviceFormatError("None of %s is supported by your kernel" % ",".join(default_fstypes)) def getFormat(fmt_type, *args, **kwargs): """ Return a DeviceFormat instance based on fmt_type and args. diff --git a/pyanaconda/storage/partitioning.py b/pyanaconda/storage/partitioning.py index 0c98f57..a594697 100644 --- a/pyanaconda/storage/partitioning.py +++ b/pyanaconda/storage/partitioning.py @@ -29,6 +29,7 @@ from pykickstart.constants import * from pyanaconda.constants import * +from pyanaconda.errors import DispatchError from errors import * from deviceaction import * from devices import PartitionDevice, LUKSDevice, devicePathToName diff --git a/pyanaconda/storage/zfcp.py b/pyanaconda/storage/zfcp.py index 9622c19..f3997c6 100644 --- a/pyanaconda/storage/zfcp.py +++ b/pyanaconda/storage/zfcp.py @@ -165,8 +165,8 @@ class ZFCPDevice: if os.path.exists(portadd): # older zfcp sysfs interface log.info("WWPN %(wwpn)s at zFCP device %(devnum)s already " - "there.") % {'wwpn': self.wwpn, - 'devnum': self.devnum} + "there." % {'wwpn': self.wwpn, + 'devnum': self.devnum}) if not os.path.exists(unitdir): try: diff --git a/pyanaconda/textw/upgrade_bootloader_text.py b/pyanaconda/textw/upgrade_bootloader_text.py index a6f0c6b..10c0cce 100644 --- a/pyanaconda/textw/upgrade_bootloader_text.py +++ b/pyanaconda/textw/upgrade_bootloader_text.py @@ -88,12 +88,12 @@ class UpgradeBootloaderWindow: return INSTALL_BACK if blradio.getSelection() == "nobl": - self.dispatch.skip_steps("bootloader") - self.dispatch.skip_steps("instbootloader") + anaconda.dispatch.skip_steps("bootloader") + anaconda.dispatch.skip_steps("instbootloader") anaconda.bootloader.update_only = False else: - self.dispatch.skip_steps("bootloader") - self.dispatch.request_steps("instbootloader") + anaconda.dispatch.skip_steps("bootloader") + anaconda.dispatch.request_steps("instbootloader") anaconda.bootloader.update_only = anaconda.bootloader.can_update screen.popWindow() diff --git a/pyanaconda/textw/upgrade_text.py b/pyanaconda/textw/upgrade_text.py index 0b973a3..f6ddeda 100644 --- a/pyanaconda/textw/upgrade_text.py +++ b/pyanaconda/textw/upgrade_text.py @@ -25,6 +25,7 @@ from snack import * from pyanaconda.flags import flags from pyanaconda.constants import * from pyanaconda.storage.formats import getFormat +from pyanaconda.storage.deviceaction import ActionMigrateFormat import gettext _ = lambda x: gettext.ldgettext("anaconda", x)