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

CHange parameter name

parent 03b9e296
...@@ -117,7 +117,7 @@ class UrlCheckerBotTestCase(unittest.TestCase): ...@@ -117,7 +117,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping={ mapping={
"SQLITE": ":memory:", "SQLITE": ":memory:",
"DOMAIN": "example.org", "DOMAIN": "example.org",
"DNS": "\n".join([resolver_ip, resolver_ip_2]), "NAMESERVER": "\n".join([resolver_ip, resolver_ip_2]),
} }
) )
bot.initDB() bot.initDB()
...@@ -169,7 +169,7 @@ class UrlCheckerBotTestCase(unittest.TestCase): ...@@ -169,7 +169,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping={ mapping={
"SQLITE": ":memory:", "SQLITE": ":memory:",
"DOMAIN": "\n".join([domain_1, domain_2]), "DOMAIN": "\n".join([domain_1, domain_2]),
"DNS": resolver_ip, "NAMESERVER": resolver_ip,
} }
) )
bot.initDB() bot.initDB()
...@@ -214,7 +214,7 @@ class UrlCheckerBotTestCase(unittest.TestCase): ...@@ -214,7 +214,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping={ mapping={
"SQLITE": ":memory:", "SQLITE": ":memory:",
"DOMAIN": domain, "DOMAIN": domain,
"DNS": resolver_ip, "NAMESERVER": resolver_ip,
} }
) )
bot.initDB() bot.initDB()
...@@ -270,7 +270,7 @@ class UrlCheckerBotTestCase(unittest.TestCase): ...@@ -270,7 +270,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping={ mapping={
"SQLITE": ":memory:", "SQLITE": ":memory:",
"DOMAIN": sub_domain, "DOMAIN": sub_domain,
"DNS": resolver_ip, "NAMESERVER": resolver_ip,
} }
) )
bot.initDB() bot.initDB()
...@@ -315,7 +315,7 @@ class UrlCheckerBotTestCase(unittest.TestCase): ...@@ -315,7 +315,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping={ mapping={
"SQLITE": ":memory:", "SQLITE": ":memory:",
"URL": "https://example.org/foo", "URL": "https://example.org/foo",
"DNS": resolver_ip, "NAMESERVER": resolver_ip,
} }
) )
bot.initDB() bot.initDB()
...@@ -358,7 +358,7 @@ class UrlCheckerBotTestCase(unittest.TestCase): ...@@ -358,7 +358,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping={ mapping={
"SQLITE": ":memory:", "SQLITE": ":memory:",
"URL": "https://example2.org/foo", "URL": "https://example2.org/foo",
"DNS": resolver_ip, "NAMESERVER": resolver_ip,
} }
) )
bot.initDB() bot.initDB()
......
...@@ -58,7 +58,7 @@ class WebBot: ...@@ -58,7 +58,7 @@ class WebBot:
# Calculate the resolver list # Calculate the resolver list
resolver_ip_list = getReachableResolverList( 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: if not resolver_ip_list:
return return
...@@ -109,7 +109,10 @@ class WebBot: ...@@ -109,7 +109,10 @@ class WebBot:
# Report the list of DNS server status # Report the list of DNS server status
query = reportNetwork( 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") print("# DNS SERVER")
resolver_ip_list = [] resolver_ip_list = []
......
...@@ -15,13 +15,13 @@ from urlchecker_bot import create_bot ...@@ -15,13 +15,13 @@ from urlchecker_bot import create_bot
@click.option( @click.option(
"--sqlite", "-s", help="The path of the sqlite DB. (default: :memory:)" "--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("--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( @click.option(
"--configuration", "-f", help="The path of the configuration file." "--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") # click.echo("Running url checker bot")
mapping = {} mapping = {}
...@@ -34,8 +34,8 @@ def runUrlChecker(run, sqlite, dns, url, domain, configuration): ...@@ -34,8 +34,8 @@ def runUrlChecker(run, sqlite, dns, url, domain, configuration):
mapping["URL"] = "" mapping["URL"] = ""
if sqlite: if sqlite:
mapping["SQLITE"] = sqlite mapping["SQLITE"] = sqlite
if dns: if nameserver:
mapping["DNS"] = dns mapping["NAMESERVER"] = nameserver
bot = create_bot(cfgfile=configuration, mapping=mapping) bot = create_bot(cfgfile=configuration, mapping=mapping)
return bot.run(run) return bot.run(run)
......
...@@ -24,8 +24,8 @@ def createConfiguration( ...@@ -24,8 +24,8 @@ def createConfiguration(
# Required values # Required values
if "SQLITE" not in config[CONFIG_SECTION]: if "SQLITE" not in config[CONFIG_SECTION]:
config[CONFIG_SECTION]["SQLITE"] = ":memory:" config[CONFIG_SECTION]["SQLITE"] = ":memory:"
if "DNS" not in config[CONFIG_SECTION]: if "NAMESERVER" not in config[CONFIG_SECTION]:
config[CONFIG_SECTION]["DNS"] = "\n".join( config[CONFIG_SECTION]["NAMESERVER"] = "\n".join(
get_default_resolver().nameservers 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