Duplicate hosts are now omitted
This commit is contained in:
parent
255994447a
commit
7e98125597
|
@ -95,7 +95,7 @@ def main():
|
|||
logger.info("No credentials provided with flags")
|
||||
if Path(".env").is_file():
|
||||
logger.debug("Loading .env")
|
||||
dotenv.load_dotenv()
|
||||
dotenv.load_dotenv(Path(Path.cwd() / ".env"))
|
||||
else:
|
||||
logger.debug("No .env file found")
|
||||
try:
|
||||
|
@ -106,7 +106,8 @@ def main():
|
|||
logger.error("No credentials provided")
|
||||
argparser.print_help()
|
||||
exit(1)
|
||||
|
||||
# For debugging, print cwd
|
||||
logger.debug(f"Current working directory: {Path.cwd()}")
|
||||
try:
|
||||
args.func(args)
|
||||
except AttributeError:
|
||||
|
|
|
@ -73,13 +73,13 @@ def convert_to_list(file: pathlib.Path) -> list:
|
|||
re.search(r"^(?:127\.0\.0\.1|0\.0\.0\.0|::1)\s+(.+?)(?:\s+#.+)?$", line)
|
||||
for line in f
|
||||
]
|
||||
hosts = [
|
||||
hosts = {
|
||||
match.group(1)
|
||||
for match in matches
|
||||
if match and match.group(1) not in loopback
|
||||
]
|
||||
}
|
||||
# print(f"First 5 hosts: {hosts[:5]}")
|
||||
return hosts
|
||||
return list(hosts)
|
||||
|
||||
|
||||
# General Utils
|
||||
|
|
Loading…
Reference in New Issue