mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-11-24 02:37:05 +00:00
Fixed B007 (unused-loop-control-variable)
This commit is contained in:
parent
c953e5784d
commit
57d05c1ab2
@ -513,7 +513,7 @@ $TTL 86400 ; default time to live
|
|||||||
zone = zone.format(domain=domain, primary_domain=env["PRIMARY_HOSTNAME"])
|
zone = zone.format(domain=domain, primary_domain=env["PRIMARY_HOSTNAME"])
|
||||||
|
|
||||||
# Add records.
|
# Add records.
|
||||||
for subdomain, querytype, value, explanation in records:
|
for subdomain, querytype, value, _explanation in records:
|
||||||
if subdomain:
|
if subdomain:
|
||||||
zone += subdomain
|
zone += subdomain
|
||||||
zone += "\tIN\t" + querytype + "\t"
|
zone += "\tIN\t" + querytype + "\t"
|
||||||
@ -898,7 +898,7 @@ def write_custom_dns_config(config, env):
|
|||||||
|
|
||||||
def set_custom_dns_record(qname, rtype, value, action, env):
|
def set_custom_dns_record(qname, rtype, value, action, env):
|
||||||
# validate qname
|
# validate qname
|
||||||
for zone, fn in get_dns_zones(env):
|
for zone, _fn in get_dns_zones(env):
|
||||||
# It must match a zone apex or be a subdomain of a zone
|
# It must match a zone apex or be a subdomain of a zone
|
||||||
# that we are otherwise hosting.
|
# that we are otherwise hosting.
|
||||||
if qname == zone or qname.endswith("."+zone):
|
if qname == zone or qname.endswith("."+zone):
|
||||||
@ -992,7 +992,7 @@ def get_secondary_dns(custom_dns, mode=None):
|
|||||||
resolver.lifetime = 10
|
resolver.lifetime = 10
|
||||||
|
|
||||||
values = []
|
values = []
|
||||||
for qname, rtype, value in custom_dns:
|
for qname, _rtype, value in custom_dns:
|
||||||
if qname != '_secondary_nameserver': continue
|
if qname != '_secondary_nameserver': continue
|
||||||
for hostname in value.split(" "):
|
for hostname in value.split(" "):
|
||||||
hostname = hostname.strip()
|
hostname = hostname.strip()
|
||||||
@ -1078,7 +1078,7 @@ def get_custom_dns_records(custom_dns, qname, rtype):
|
|||||||
|
|
||||||
def build_recommended_dns(env):
|
def build_recommended_dns(env):
|
||||||
ret = []
|
ret = []
|
||||||
for (domain, zonefile, records) in build_zones(env):
|
for (domain, _zonefile, records) in build_zones(env):
|
||||||
# remove records that we don't display
|
# remove records that we don't display
|
||||||
records = [r for r in records if r[3] is not False]
|
records = [r for r in records if r[3] is not False]
|
||||||
|
|
||||||
@ -1106,7 +1106,7 @@ if __name__ == "__main__":
|
|||||||
if sys.argv[-1] == "--lint":
|
if sys.argv[-1] == "--lint":
|
||||||
write_custom_dns_config(get_custom_dns_config(env), env)
|
write_custom_dns_config(get_custom_dns_config(env), env)
|
||||||
else:
|
else:
|
||||||
for zone, records in build_recommended_dns(env):
|
for _zone, records in build_recommended_dns(env):
|
||||||
for record in records:
|
for record in records:
|
||||||
print("; " + record['explanation'])
|
print("; " + record['explanation'])
|
||||||
print(record['qname'], record['rtype'], record['value'], sep="\t")
|
print(record['qname'], record['rtype'], record['value'], sep="\t")
|
||||||
|
@ -579,7 +579,7 @@ def kick(env, mail_result=None):
|
|||||||
|
|
||||||
# Remove auto-generated postmaster/admin/abuse alises from the main aliases table.
|
# Remove auto-generated postmaster/admin/abuse alises from the main aliases table.
|
||||||
# They are now stored in the auto_aliases table.
|
# They are now stored in the auto_aliases table.
|
||||||
for address, forwards_to, permitted_senders, auto in get_mail_aliases(env):
|
for address, forwards_to, _permitted_senders, auto in get_mail_aliases(env):
|
||||||
user, domain = address.split("@")
|
user, domain = address.split("@")
|
||||||
if user in {"postmaster", "admin", "abuse"} \
|
if user in {"postmaster", "admin", "abuse"} \
|
||||||
and address not in required_aliases \
|
and address not in required_aliases \
|
||||||
|
@ -262,7 +262,7 @@ def provision_certificates(env, limit_domains):
|
|||||||
# primary domain listed in each certificate.
|
# primary domain listed in each certificate.
|
||||||
from dns_update import get_dns_zones
|
from dns_update import get_dns_zones
|
||||||
certs = { }
|
certs = { }
|
||||||
for zone, zonefile in get_dns_zones(env):
|
for zone, _zonefile in get_dns_zones(env):
|
||||||
certs[zone] = [[]]
|
certs[zone] = [[]]
|
||||||
for domain in sort_domains(domains, env):
|
for domain in sort_domains(domains, env):
|
||||||
# Does the domain end with any domain we've seen so far.
|
# Does the domain end with any domain we've seen so far.
|
||||||
|
@ -88,7 +88,7 @@ def run_services_checks(env, output, pool):
|
|||||||
all_running = True
|
all_running = True
|
||||||
fatal = False
|
fatal = False
|
||||||
ret = pool.starmap(check_service, ((i, service, env) for i, service in enumerate(get_services())), chunksize=1)
|
ret = pool.starmap(check_service, ((i, service, env) for i, service in enumerate(get_services())), chunksize=1)
|
||||||
for i, running, fatal2, output2 in sorted(ret):
|
for _i, running, fatal2, output2 in sorted(ret):
|
||||||
if output2 is None: continue # skip check (e.g. no port was set, e.g. no sshd)
|
if output2 is None: continue # skip check (e.g. no port was set, e.g. no sshd)
|
||||||
all_running = all_running and running
|
all_running = all_running and running
|
||||||
fatal = fatal or fatal2
|
fatal = fatal or fatal2
|
||||||
|
@ -148,7 +148,7 @@ def du(path):
|
|||||||
# soft and hard links.
|
# soft and hard links.
|
||||||
total_size = 0
|
total_size = 0
|
||||||
seen = set()
|
seen = set()
|
||||||
for dirpath, dirnames, filenames in os.walk(path):
|
for dirpath, _dirnames, filenames in os.walk(path):
|
||||||
for f in filenames:
|
for f in filenames:
|
||||||
fp = os.path.join(dirpath, f)
|
fp = os.path.join(dirpath, f)
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user