This removes unused variables in the rest of the code (outside lib/).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Olivier Tharan <olive@google.com>
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))
"""
global client # pylint: disable-msg=W0603
- options, args = ParseOptions()
+ options, _ = ParseOptions()
utils.SetupLogging(constants.LOG_WATCHER, debug=options.debug,
stderr_logging=options.debug)
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
@return: the desired exit code
"""
- instance = args[0]
op = opcodes.OpRemoveExport(instance_name=args[0])
SubmitOpCode(op)
# 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
@return: the desired exit code
"""
- instance_name = args[0]
new_2ndary = opts.dst_node
iallocator = opts.iallocator
if opts.disks is None:
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?
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
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 = {}
"""
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
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"
"""
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
"""
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
This is just a wrapper over BootStrap, to handle our own exceptions.
"""
- options, args = ParseOptions()
+ _, args = ParseOptions()
if args:
cfg_file = args[0]
else:
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)
"""
path = "/dev/%s" % name
- for retries in range(40):
+ for _ in range(40):
if os.path.exists(path):
break
time.sleep(0.250)
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
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
" 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:
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))