X-Git-Url: http://git.datanom.net/netconf.git/blobdiff_plain/0b4b929c889fb8f9ae1f0dab4c1fea029512a6b5..e8e90d5ac872f27ce57d0f3451016f83949c1315:/netconf?ds=sidebyside diff --git a/netconf b/netconf index 2f0694f..25d3bff 100644 --- a/netconf +++ b/netconf @@ -146,7 +146,8 @@ def usage(): -g, --gateway Default gateway. Optional. -i, --interface Interface to configure. -m, --netmask Netmask to use for interface. Default /24. - -n, --nameserver Nameserver to use. Optional.""" + -n, --nameserver Nameserver to use. Optional. + -r, --record Output create commands to stdout.""" def parse_input(): options = () @@ -182,11 +183,18 @@ def parse_input(): record = True else: assert False, 'Unhandled option' - - if not address or not interface: - print 'Error: missing options' - usage() - sys.exit(2) + + if (record): + if not (bool(address) ^ bool(interface)): + print 'Error: missing options' + usage() + sys.exit(2) + else: + if not address or not interface or error: + print 'Error: missing options' + usage() + sys.exit(2) + if address == '0': address = None if not netmask: