"NODE_PLACEMENT_OPT",
"NOHDR_OPT",
"NOIPCHECK_OPT",
+ "NONAMECHECK_OPT",
"NOLVM_STORAGE_OPT",
"NOMODIFY_ETCHOSTS_OPT",
"NOMODIFY_SSH_SETUP_OPT",
class _Argument:
- def __init__(self, min=0, max=None):
+ def __init__(self, min=0, max=None): # pylint: disable-msg=W0622
self.min = min
self.max = max
Value can be any of the ones passed to the constructor.
"""
+ # pylint: disable-msg=W0622
def __init__(self, min=0, max=None, choices=None):
_Argument.__init__(self, min=min, max=max)
self.choices = choices
ARGS_ONE_NODE = [ArgNode(min=1, max=1)]
-
def _ExtractTagsObject(opts, args):
"""Extract the tag type object.
"""
kind, name = _ExtractTagsObject(opts, args)
- op = opcodes.OpGetTags(kind=kind, name=name)
- result = SubmitOpCode(op)
+ cl = GetClient()
+ result = cl.QueryTags(kind, name)
result = list(result)
result.sort()
for tag in result:
SubmitOpCode(op)
-def check_unit(option, opt, value):
+def check_unit(option, opt, value): # pylint: disable-msg=W0613
"""OptParsers custom converter for units.
"""
"""
kv_dict = {}
if data:
- for elem in data.split(","):
+ for elem in utils.UnescapeAndSplit(data, sep=","):
if "=" in elem:
key, val = elem.split("=", 1)
else:
return kv_dict
-def check_ident_key_val(option, opt, value):
+def check_ident_key_val(option, opt, value): # pylint: disable-msg=W0613
"""Custom parser for ident:key=val,key=val options.
This will store the parsed values as a tuple (ident, {key: val}). As such,
return retval
-def check_key_val(option, opt, value):
+def check_key_val(option, opt, value): # pylint: disable-msg=W0613
"""Custom parser class for key=val,key=val options.
This will store the parsed values as a dict {key: val}.
help="Don't check that the instance's IP"
" is alive")
+NONAMECHECK_OPT = cli_option("--no-name-check", dest="name_check",
+ default=True, action="store_false",
+ help="Don't check that the instance's name"
+ " is resolvable")
+
NET_OPT = cli_option("--net",
help="NIC parameters", default=[],
dest="nics", action="append", type="identkeyval")
if opts.nics:
try:
- nic_max = max(int(nidx[0])+1 for nidx in opts.nics)
+ nic_max = max(int(nidx[0]) + 1 for nidx in opts.nics)
except ValueError, err:
raise errors.OpPrereqError("Invalid NIC index passed: %s" % str(err))
nics = [{}] * nic_max
if opts.sd_size is not None:
opts.disks = [(0, {"size": opts.sd_size})]
try:
- disk_max = max(int(didx[0])+1 for didx in opts.disks)
+ disk_max = max(int(didx[0]) + 1 for didx in opts.disks)
except ValueError, err:
raise errors.OpPrereqError("Invalid disk index passed: %s" % str(err))
disks = [{}] * disk_max
nics=nics,
pnode=pnode, snode=snode,
ip_check=opts.ip_check,
+ name_check=opts.name_check,
wait_for_sync=opts.wait_for_sync,
file_storage_dir=opts.file_storage_dir,
file_driver=opts.file_driver,
if unitfields is None:
unitfields = []
- numfields = utils.FieldSet(*numfields)
- unitfields = utils.FieldSet(*unitfields)
+ numfields = utils.FieldSet(*numfields) # pylint: disable-msg=W0142
+ unitfields = utils.FieldSet(*unitfields) # pylint: disable-msg=W0142
format_fields = []
for field in fields:
args.append(hdr)
result.append(format % tuple(args))
+ if separator is None:
+ assert len(mlens) == len(fields)
+
+ if fields and not numfields.Matches(fields[-1]):
+ mlens[-1] = 0
+
for line in data:
args = []
if line is None:
use_locking=False)
offline = [row[0] for row in result if row[1]]
if offline and not nowarn:
- ToStderr("Note: skipping offline node(s): %s" % ", ".join(offline))
+ ToStderr("Note: skipping offline node(s): %s" % utils.CommaJoin(offline))
return [row[0] for row in result if not row[1]]
if self.verbose:
ok_jobs = [row[1] for row in self.jobs if row[0]]
if ok_jobs:
- ToStdout("Submitted jobs %s", ", ".join(ok_jobs))
+ ToStdout("Submitted jobs %s", utils.CommaJoin(ok_jobs))
for submit_status, jid, name in self.jobs:
if not submit_status:
ToStderr("Failed to submit job for %s: %s", name, jid)