Skip to content

Commit a5c6510

Browse files
author
jokob-sk
committed
less verbose AVAHISCAN logs
1 parent 6d44ed1 commit a5c6510

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed
Loading

front/php/templates/language/fr_fr.json

100644100755
File mode changed.

front/plugins/avahi_scan/avahi_scan.py

+17-17
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ def execute_name_lookup(ip, timeout):
108108
output = ""
109109

110110
try:
111-
mylog('verbose', [f'[{pluginName}] DEBUG CMD :', args])
111+
mylog('debug', [f'[{pluginName}] DEBUG CMD :', args])
112112

113113
# Run the subprocess with a forced timeout
114114
output = subprocess.check_output(args, universal_newlines=True, stderr=subprocess.STDOUT, timeout=timeout)
115115

116-
mylog('verbose', [f'[{pluginName}] DEBUG OUTPUT : {output}'])
116+
mylog('debug', [f'[{pluginName}] DEBUG OUTPUT : {output}'])
117117

118118
domain_name = ''
119119

@@ -129,20 +129,20 @@ def execute_name_lookup(ip, timeout):
129129
else:
130130
mylog('verbose', [f'[{pluginName}] ⚠ ERROR - Unexpected output format: {line}'])
131131

132-
mylog('verbose', [f'[{pluginName}] Domain Name: {domain_name}'])
132+
mylog('debug', [f'[{pluginName}] Domain Name: {domain_name}'])
133133

134134
return domain_name
135135

136136
except subprocess.CalledProcessError as e:
137-
mylog('verbose', [f'[{pluginName}] ⚠ ERROR - {e.output}'])
137+
mylog('none', [f'[{pluginName}] ⚠ ERROR - {e.output}'])
138138

139139
except subprocess.TimeoutExpired:
140-
mylog('verbose', [f'[{pluginName}] TIMEOUT - the process forcefully terminated as timeout reached'])
140+
mylog('none', [f'[{pluginName}] TIMEOUT - the process forcefully terminated as timeout reached'])
141141

142142
if output == "":
143-
mylog('verbose', [f'[{pluginName}] Scan: FAIL - check logs'])
143+
mylog('none', [f'[{pluginName}] Scan: FAIL - check logs'])
144144
else:
145-
mylog('verbose', [f'[{pluginName}] Scan: SUCCESS'])
145+
mylog('debug', [f'[{pluginName}] Scan: SUCCESS'])
146146

147147
return ''
148148

@@ -151,13 +151,13 @@ def ensure_avahi_running(attempt=1, max_retries=2):
151151
"""
152152
Ensure that D-Bus is running and the Avahi daemon is started, with recursive retry logic.
153153
"""
154-
mylog('verbose', [f'[{pluginName}] Attempt {attempt} - Ensuring D-Bus and Avahi daemon are running...'])
154+
mylog('debug', [f'[{pluginName}] Attempt {attempt} - Ensuring D-Bus and Avahi daemon are running...'])
155155

156156
# Check rc-status
157157
try:
158158
subprocess.run(['rc-status'], check=True)
159159
except subprocess.CalledProcessError as e:
160-
mylog('verbose', [f'[{pluginName}] ⚠ ERROR - Failed to check rc-status: {e.output}'])
160+
mylog('none', [f'[{pluginName}] ⚠ ERROR - Failed to check rc-status: {e.output}'])
161161
return
162162

163163
# Create OpenRC soft level
@@ -167,42 +167,42 @@ def ensure_avahi_running(attempt=1, max_retries=2):
167167
try:
168168
subprocess.run(['rc-update', 'add', 'avahi-daemon'], check=True)
169169
except subprocess.CalledProcessError as e:
170-
mylog('verbose', [f'[{pluginName}] ⚠ ERROR - Failed to add Avahi to runlevel: {e.output}'])
170+
mylog('none', [f'[{pluginName}] ⚠ ERROR - Failed to add Avahi to runlevel: {e.output}'])
171171
return
172172

173173
# Start the D-Bus service
174174
try:
175175
subprocess.run(['rc-service', 'dbus', 'start'], check=True)
176176
except subprocess.CalledProcessError as e:
177-
mylog('verbose', [f'[{pluginName}] ⚠ ERROR - Failed to start D-Bus: {e.output}'])
177+
mylog('none', [f'[{pluginName}] ⚠ ERROR - Failed to start D-Bus: {e.output}'])
178178
return
179179

180180
# Check Avahi status
181181
status_output = subprocess.run(['rc-service', 'avahi-daemon', 'status'], capture_output=True, text=True)
182182
if 'started' in status_output.stdout:
183-
mylog('verbose', [f'[{pluginName}] Avahi Daemon is already running.'])
183+
mylog('debug', [f'[{pluginName}] Avahi Daemon is already running.'])
184184
return
185185

186-
mylog('verbose', [f'[{pluginName}] Avahi Daemon is not running, attempting to start... (Attempt {attempt})'])
186+
mylog('none', [f'[{pluginName}] Avahi Daemon is not running, attempting to start... (Attempt {attempt})'])
187187

188188
# Start the Avahi daemon
189189
try:
190190
subprocess.run(['rc-service', 'avahi-daemon', 'start'], check=True)
191191
except subprocess.CalledProcessError as e:
192-
mylog('verbose', [f'[{pluginName}] ⚠ ERROR - Failed to start Avahi daemon: {e.output}'])
192+
mylog('none', [f'[{pluginName}] ⚠ ERROR - Failed to start Avahi daemon: {e.output}'])
193193

194194
# Check status after starting
195195
status_output = subprocess.run(['rc-service', 'avahi-daemon', 'status'], capture_output=True, text=True)
196196
if 'started' in status_output.stdout:
197-
mylog('verbose', [f'[{pluginName}] Avahi Daemon successfully started.'])
197+
mylog('debug', [f'[{pluginName}] Avahi Daemon successfully started.'])
198198
return
199199

200200
# Retry if not started and attempts are left
201201
if attempt < max_retries:
202-
mylog('verbose', [f'[{pluginName}] Retrying... ({attempt + 1}/{max_retries})'])
202+
mylog('debug', [f'[{pluginName}] Retrying... ({attempt + 1}/{max_retries})'])
203203
ensure_avahi_running(attempt + 1, max_retries)
204204
else:
205-
mylog('verbose', [f'[{pluginName}] ⚠ ERROR - Avahi Daemon failed to start after {max_retries} attempts.'])
205+
mylog('none', [f'[{pluginName}] ⚠ ERROR - Avahi Daemon failed to start after {max_retries} attempts.'])
206206

207207
# rc-update add avahi-daemon
208208
# rc-service avahi-daemon status

0 commit comments

Comments
 (0)