Commit f4ad2ef0 authored by Iustin Pop's avatar Iustin Pop
Browse files

Remove more unused variables



This removes unused variables in the rest of the code (outside lib/).
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarOlivier Tharan <olive@google.com>
parent 7260cfbe
......@@ -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))
......
......@@ -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)
......
......@@ -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)
......
......@@ -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
......
......@@ -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:
......
......@@ -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?
......
......@@ -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
......
......@@ -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 = {}
......
......@@ -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:
......
......@@ -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))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment