Skip to content

Commit

Permalink
🎨 Format Python code with Black, and Bash code with Shfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
alexAubin authored and github-actions[bot] committed Feb 26, 2025
1 parent 9f7889c commit c4b2be2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ def identify_data_to_redact(self, record):
"Failed to parse line to try to identify data to redact ... : %s" % e
)


class OperationLogger:
"""
Instances of this class represents unit operation done on the ynh instance.
Expand Down Expand Up @@ -1001,8 +1002,8 @@ def log_share(path):

def _guess_who_started_process(process):

if 'SUDO_USER' in process.environ():
return process.environ()['SUDO_USER']
if "SUDO_USER" in process.environ():
return process.environ()["SUDO_USER"]

parent = process.parent()
parent_cli = parent.cmdline()
Expand All @@ -1013,9 +1014,12 @@ def _guess_who_started_process(process):

if any("/usr/sbin/CRON" in cli for cli in [parent_cli, pparent_cli, ppparent_cli]):
return m18n.n("automatic_task")
elif any("/usr/bin/yunohost-api" in cli for cli in [parent_cli, pparent_cli, ppparent_cli]):
elif any(
"/usr/bin/yunohost-api" in cli
for cli in [parent_cli, pparent_cli, ppparent_cli]
):
return m18n.n("yunohost_api")
elif process.terminal() is None:
return m18n.n("noninteractive_task")
else:
return "root"
return "root"

0 comments on commit c4b2be2

Please sign in to comment.