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