Commit 74e39c3d authored by Romain Courteaud's avatar Romain Courteaud

CHange parameter name

parent 03b9e296
......@@ -117,7 +117,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping={
"SQLITE": ":memory:",
"DOMAIN": "example.org",
"DNS": "\n".join([resolver_ip, resolver_ip_2]),
"NAMESERVER": "\n".join([resolver_ip, resolver_ip_2]),
}
)
bot.initDB()
......@@ -169,7 +169,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping={
"SQLITE": ":memory:",
"DOMAIN": "\n".join([domain_1, domain_2]),
"DNS": resolver_ip,
"NAMESERVER": resolver_ip,
}
)
bot.initDB()
......@@ -214,7 +214,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping={
"SQLITE": ":memory:",
"DOMAIN": domain,
"DNS": resolver_ip,
"NAMESERVER": resolver_ip,
}
)
bot.initDB()
......@@ -270,7 +270,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping={
"SQLITE": ":memory:",
"DOMAIN": sub_domain,
"DNS": resolver_ip,
"NAMESERVER": resolver_ip,
}
)
bot.initDB()
......@@ -315,7 +315,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping={
"SQLITE": ":memory:",
"URL": "https://example.org/foo",
"DNS": resolver_ip,
"NAMESERVER": resolver_ip,
}
)
bot.initDB()
......@@ -358,7 +358,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping={
"SQLITE": ":memory:",
"URL": "https://example2.org/foo",
"DNS": resolver_ip,
"NAMESERVER": resolver_ip,
}
)
bot.initDB()
......
......@@ -58,7 +58,7 @@ class WebBot:
# Calculate the resolver list
resolver_ip_list = getReachableResolverList(
self._db, status_id, self.config["DNS"].split()
self._db, status_id, self.config["NAMESERVER"].split()
)
if not resolver_ip_list:
return
......@@ -109,7 +109,10 @@ class WebBot:
# Report the list of DNS server status
query = reportNetwork(
self._db, port="53", transport="UDP", ip=self.config["DNS"].split()
self._db,
port="53",
transport="UDP",
ip=self.config["NAMESERVER"].split(),
)
print("# DNS SERVER")
resolver_ip_list = []
......
......@@ -15,13 +15,13 @@ from urlchecker_bot import create_bot
@click.option(
"--sqlite", "-s", help="The path of the sqlite DB. (default: :memory:)"
)
@click.option("--dns", "-d", help="The IP of the DNS server.")
@click.option("--nameserver", "-n", help="The IP of the DNS server.")
@click.option("--url", "-u", help="The url to check.")
@click.option("--domain", "-m", help="The domain to check.")
@click.option("--domain", "-d", help="The domain to check.")
@click.option(
"--configuration", "-f", help="The path of the configuration file."
)
def runUrlChecker(run, sqlite, dns, url, domain, configuration):
def runUrlChecker(run, sqlite, nameserver, url, domain, configuration):
# click.echo("Running url checker bot")
mapping = {}
......@@ -34,8 +34,8 @@ def runUrlChecker(run, sqlite, dns, url, domain, configuration):
mapping["URL"] = ""
if sqlite:
mapping["SQLITE"] = sqlite
if dns:
mapping["DNS"] = dns
if nameserver:
mapping["NAMESERVER"] = nameserver
bot = create_bot(cfgfile=configuration, mapping=mapping)
return bot.run(run)
......
......@@ -24,8 +24,8 @@ def createConfiguration(
# Required values
if "SQLITE" not in config[CONFIG_SECTION]:
config[CONFIG_SECTION]["SQLITE"] = ":memory:"
if "DNS" not in config[CONFIG_SECTION]:
config[CONFIG_SECTION]["DNS"] = "\n".join(
if "NAMESERVER" not in config[CONFIG_SECTION]:
config[CONFIG_SECTION]["NAMESERVER"] = "\n".join(
get_default_resolver().nameservers
)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment