🚨 — Make ruff and pylint happy

This commit is contained in:
Luc Didry 2024-08-27 11:11:31 +02:00
parent a25cfea8c0
commit aac7ca4ec5
No known key found for this signature in database
GPG key ID: EA868E12D0257E3C

View file

@ -226,8 +226,7 @@ async def watch_agents(time_without_agent, config):
db = await get_db()
agents = await queries.get_recent_agents_count(db, time_without_agent)
if agents == 0:
click.echo(
f"No agent has been seen in the last {time_without_agent} minutes.")
click.echo(f"No agent has been seen in the last {time_without_agent} minutes.")
sysexit(1)
@ -524,8 +523,7 @@ async def show(config):
status = ""
if _user.disabled:
status = ""
click.echo(
f"{status} {_user.username}, last login: {_user.last_login_at}")
click.echo(f"{status} {_user.username}, last login: {_user.last_login_at}")
@server.command(short_help="Generate a token for agents")
@ -580,41 +578,40 @@ async def test_mail(config, domain, severity):
if not conf.general.mail:
click.echo("Mail is not configured, cannot test", err=True)
sysexit(1)
return
else:
now = datetime.now()
task = Task(
url=f"https://{domain}",
domain=domain,
check="body-contains",
expected="foo",
frequency=1,
selected_by="test",
selected_at=now,
)
now = datetime.now()
task = Task(
url=f"https://{domain}",
domain=domain,
check="body-contains",
expected="foo",
frequency=1,
selected_by="test",
selected_at=now,
)
result = Result(
submitted_at=now,
status="success",
context={"foo": "bar"},
task=task,
agent_id="test",
severity="ok",
)
result = Result(
submitted_at=now,
status="success",
context={"foo": "bar"},
task=task,
agent_id="test",
severity="ok",
)
class _FalseRequest:
def url_for(*args, **kwargs):
return "/url"
class _FalseRequest:
def url_for(*args, **kwargs):
return "/url"
set_log_level("debug")
notify_by_mail(
result,
task,
severity="SEVERITY",
old_severity="OLD SEVERITY",
config=conf.general.mail,
request=_FalseRequest(),
)
set_log_level("debug")
notify_by_mail(
result,
task,
severity="SEVERITY",
old_severity="OLD SEVERITY",
config=conf.general.mail,
request=_FalseRequest(),
)
if __name__ == "__main__":