Revision 58bb385c daemons/import-export
b/daemons/import-export | ||
---|---|---|
362 | 362 |
help="X509 CA file") |
363 | 363 |
parser.add_option("--bind", dest="bind", action="store", type="string", |
364 | 364 |
help="Bind address") |
365 |
parser.add_option("--ipv4", dest="ipv4", action="store_true", |
|
366 |
help="Use IPv4 only") |
|
367 |
parser.add_option("--ipv6", dest="ipv6", action="store_true", |
|
368 |
help="Use IPv6 only") |
|
365 | 369 |
parser.add_option("--host", dest="host", action="store", type="string", |
366 | 370 |
help="Remote hostname") |
367 | 371 |
parser.add_option("--port", dest="port", action="store", type="int", |
... | ... | |
401 | 405 |
parser.error("Invalid mode: %s" % mode) |
402 | 406 |
|
403 | 407 |
# Normalize and check parameters |
404 |
if options.host is not None: |
|
408 |
if options.host is not None and not netutils.IPAddress.IsValid(options.host):
|
|
405 | 409 |
try: |
406 | 410 |
options.host = netutils.Hostname.GetNormalizedName(options.host) |
407 | 411 |
except errors.OpPrereqError, err: |
... | ... | |
423 | 427 |
parser.error("Magic must match regular expression %s" % |
424 | 428 |
constants.IE_MAGIC_RE.pattern) |
425 | 429 |
|
430 |
if options.ipv4 and options.ipv6: |
|
431 |
parser.error("Can only use one of --ipv4 and --ipv6") |
|
432 |
|
|
426 | 433 |
return (status_file_path, mode) |
427 | 434 |
|
428 | 435 |
|
Also available in: Unified diff