Added -v option for verbose output. Overrides quiet option in config file

Fixed bug when empty lines in config file
This commit is contained in:
2004-01-20 20:51:31 +00:00
parent 62c25b16a5
commit bd176254f5

View File

@@ -71,6 +71,9 @@ def getparams(msg):
parser.add_option("-t", "--ttl", parser.add_option("-t", "--ttl",
type="int", type="int",
help="TTL in seconds") help="TTL in seconds")
parser.add_option("-v", "--verbose",
action="store_true",
help="Print progress information")
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
@@ -79,7 +82,6 @@ def getparams(msg):
msg = readcfg(msg) msg = readcfg(msg)
# Populate the basic params # Populate the basic params
base_params = ['delete', base_params = ['delete',
'domain', 'domain',
@@ -103,6 +105,9 @@ def getparams(msg):
if ip: if ip:
msg['ipaddress'] = ip msg['ipaddress'] = ip
if options.verbose and msg.has_key('quiet'):
del msg['quiet']
return msg return msg
@@ -123,7 +128,7 @@ def readcfg(msg):
for line in cfgfile.readlines(): for line in cfgfile.readlines():
line = line.strip() line = line.strip()
if line.find("#", 0, 1) == 0: if line.find("#", 0, 1) == 0 or not line:
continue continue
(key, value) = line.split('\t', 1) (key, value) = line.split('\t', 1)
if not value.strip().lower() == "false": if not value.strip().lower() == "false":