diff --git a/daemons/ganeti-rapi b/daemons/ganeti-rapi index 96d5c7a16985c86878792422e9662b617f458243..48816c10e0c572c8776751faecdb9e0c8e8bcb12 100755 --- a/daemons/ganeti-rapi +++ b/daemons/ganeti-rapi @@ -110,7 +110,7 @@ class RemoteApiHttpServer(http.auth.HttpServerRequestAuthentication, method = req.request_method.upper() try: ctx.handler_fn = getattr(ctx.handler, method) - except AttributeError, err: + except AttributeError: raise http.HttpBadRequest("Method %s is unsupported for path %s" % (method, req.request_path)) diff --git a/daemons/ganeti-watcher b/daemons/ganeti-watcher index 71b548f2e2cf9d719d38a509451921342349db41..d82b8ba0046474834c4d8a3aec6c93783a57a25b 100755 --- a/daemons/ganeti-watcher +++ b/daemons/ganeti-watcher @@ -470,7 +470,7 @@ def main(): """ global client # pylint: disable-msg=W0603 - options, args = ParseOptions() + options, _ = ParseOptions() utils.SetupLogging(constants.LOG_WATCHER, debug=options.debug, stderr_logging=options.debug) diff --git a/scripts/gnt-backup b/scripts/gnt-backup index 4d65648b5645fcbe23af75c101202d498136f8dc..2890ecb1116cc497c68710283af68a7b303e9989 100755 --- a/scripts/gnt-backup +++ b/scripts/gnt-backup @@ -81,7 +81,6 @@ def ExportInstance(opts, args): if not isinstance(dlist, list): ToStderr("Cannot parse execution results") return 1 - tot_dsk = len(dlist) # TODO: handle diskless instances if dlist.count(False) == 0: # all OK @@ -119,7 +118,6 @@ def RemoveExport(opts, args): @return: the desired exit code """ - instance = args[0] op = opcodes.OpRemoveExport(instance_name=args[0]) SubmitOpCode(op) diff --git a/scripts/gnt-cluster b/scripts/gnt-cluster index 59f1b3092b0a1f7cbb7378abf6fff1d9dd2e3a36..fc978948e33558c8b9f765778956364fb4ed2cdd 100755 --- a/scripts/gnt-cluster +++ b/scripts/gnt-cluster @@ -512,7 +512,7 @@ def SetClusterParams(opts, args): # a list of (name, dict) we can pass directly to dict() (or []) hvparams = dict(opts.hvparams) - for hv, hv_params in hvparams.iteritems(): + for hv_params in hvparams.values(): utils.ForceDictType(hv_params, constants.HVS_PARAMETER_TYPES) beparams = opts.beparams diff --git a/scripts/gnt-instance b/scripts/gnt-instance index 4fc8c8ef4a804b477183782b68472dce646eafa9..ec08c0d0487bff78390b7eea10acac95f30d9785 100755 --- a/scripts/gnt-instance +++ b/scripts/gnt-instance @@ -756,7 +756,6 @@ def ReplaceDisks(opts, args): @return: the desired exit code """ - instance_name = args[0] new_2ndary = opts.dst_node iallocator = opts.iallocator if opts.disks is None: diff --git a/scripts/gnt-job b/scripts/gnt-job index cd4612b5e1f6fb4a956e7cfa478921afb7454e75..f377478cb196519b559811387d88ba45bbac774b 100755 --- a/scripts/gnt-job +++ b/scripts/gnt-job @@ -181,7 +181,7 @@ def CancelJobs(opts, args): client = GetClient() for job_id in args: - (success, msg) = client.CancelJob(job_id) + (_, msg) = client.CancelJob(job_id) ToStdout(msg) # TODO: Different exit value if not all jobs were canceled? diff --git a/scripts/gnt-node b/scripts/gnt-node index 26cfd7e515ec89ca2d70a1ba8639013329008a0a..b639b58aca3b43739badb11883ac2e5d94c0fda5 100755 --- a/scripts/gnt-node +++ b/scripts/gnt-node @@ -356,8 +356,6 @@ def MigrateNode(opts, args): pinst = utils.NiceSort(pinst) - retcode = 0 - if not force and not AskUser("Migrate instance(s) %s?" % (",".join("'%s'" % name for name in pinst))): return 2 diff --git a/scripts/gnt-os b/scripts/gnt-os index ed8d27f60a1bbd4a0d253169b790f3611a2e7109..40bea5516dc96a3331689fc3958667d5241e8db3 100755 --- a/scripts/gnt-os +++ b/scripts/gnt-os @@ -106,7 +106,7 @@ def DiagnoseOS(opts, args): has_bad = False - for os_name, os_valid, os_variants, node_data in result: + for os_name, _, os_variants, node_data in result: nodes_valid = {} nodes_bad = {} nodes_hidden = {} diff --git a/tools/cfgshell b/tools/cfgshell index acdf9fb5a02f43df6b2c08e9b732fccad4fd7cb1..b3d59689df967ad27ec1c876def76176ce1c562f 100755 --- a/tools/cfgshell +++ b/tools/cfgshell @@ -177,7 +177,7 @@ class ConfigShell(cmd.Cmd): """ pointer = self.parents[-1] - dirs, entries = self._get_entries(pointer) + dirs, _ = self._get_entries(pointer) matches = [str(name) for name in dirs if name.startswith(text)] return matches @@ -202,7 +202,7 @@ class ConfigShell(cmd.Cmd): return False pointer = self.parents[-1] - dirs, entries = self._get_entries(pointer) + dirs, _ = self._get_entries(pointer) if line not in dirs: print "No such child" @@ -232,7 +232,7 @@ class ConfigShell(cmd.Cmd): """ pointer = self.parents[-1] - dirs, entries = self._get_entries(pointer) + _, entries = self._get_entries(pointer) matches = [name for name in entries if name.startswith(text)] return matches @@ -244,7 +244,7 @@ class ConfigShell(cmd.Cmd): """ pointer = self.parents[-1] - dirs, entries = self._get_entries(pointer) + _, entries = self._get_entries(pointer) if line not in entries: print "No such entry" return False @@ -351,7 +351,7 @@ def main(): This is just a wrapper over BootStrap, to handle our own exceptions. """ - options, args = ParseOptions() + _, args = ParseOptions() if args: cfg_file = args[0] else: diff --git a/tools/lvmstrap b/tools/lvmstrap index bd867d027ddae2b40b91d79e40a9534b93128a10..01ad670c5ab67e62cf2b8632d22a4098dd2720b4 100755 --- a/tools/lvmstrap +++ b/tools/lvmstrap @@ -192,7 +192,7 @@ def CheckPrereq(): if os.getuid() != 0: raise PrereqError("This tool runs as root only. Really.") - osname, nodename, release, version, arch = os.uname() + osname, _, release, _, _ = os.uname() if osname != 'Linux': raise PrereqError("This tool only runs on Linux" " (detected OS: %s)." % osname) @@ -271,7 +271,7 @@ def CheckSysDev(name, devnum): """ path = "/dev/%s" % name - for retries in range(40): + for _ in range(40): if os.path.exists(path): break time.sleep(0.250) @@ -426,7 +426,7 @@ def GetMountInfo(): mountlines = ReadFile("/proc/mounts").splitlines() mounts = {} for line in mountlines: - device, mountpoint, fstype, rest = line.split(None, 3) + _, mountpoint, fstype, _ = line.split(None, 3) # fs type blacklist if fstype in ["nfs", "nfs4", "autofs", "tmpfs", "proc", "sysfs"]: continue @@ -542,7 +542,7 @@ def CheckReread(name): boolean, the in-use status of the device """ - for retries in range(3): + for _ in range(3): result = ExecCommand("blockdev --rereadpt /dev/%s" % name) if not result.failed: break @@ -672,7 +672,7 @@ def ValidateDiskList(options): " non-removable block devices).") sysd_free = [] sysd_used = [] - for name, size, dev, part, used in sysdisks: + for name, _, _, _, used in sysdisks: if used: sysd_used.append(name) else: @@ -726,7 +726,7 @@ def BootStrap(): CreatePVOnDisk(disk) CreateVG(vgname, disklist) - status, lv_count, size, free = CheckVGExists(vgname) + status, lv_count, size, _ = CheckVGExists(vgname) if status: print "Done! %s: size %s GiB, disks: %s" % (vgname, size, ",".join(disklist))