@@ -108,12 +108,12 @@ def execute_name_lookup(ip, timeout):
108
108
output = ""
109
109
110
110
try :
111
- mylog ('verbose ' , [f'[{ pluginName } ] DEBUG CMD :' , args ])
111
+ mylog ('debug ' , [f'[{ pluginName } ] DEBUG CMD :' , args ])
112
112
113
113
# Run the subprocess with a forced timeout
114
114
output = subprocess .check_output (args , universal_newlines = True , stderr = subprocess .STDOUT , timeout = timeout )
115
115
116
- mylog ('verbose ' , [f'[{ pluginName } ] DEBUG OUTPUT : { output } ' ])
116
+ mylog ('debug ' , [f'[{ pluginName } ] DEBUG OUTPUT : { output } ' ])
117
117
118
118
domain_name = ''
119
119
@@ -129,20 +129,20 @@ def execute_name_lookup(ip, timeout):
129
129
else :
130
130
mylog ('verbose' , [f'[{ pluginName } ] ⚠ ERROR - Unexpected output format: { line } ' ])
131
131
132
- mylog ('verbose ' , [f'[{ pluginName } ] Domain Name: { domain_name } ' ])
132
+ mylog ('debug ' , [f'[{ pluginName } ] Domain Name: { domain_name } ' ])
133
133
134
134
return domain_name
135
135
136
136
except subprocess .CalledProcessError as e :
137
- mylog ('verbose ' , [f'[{ pluginName } ] ⚠ ERROR - { e .output } ' ])
137
+ mylog ('none ' , [f'[{ pluginName } ] ⚠ ERROR - { e .output } ' ])
138
138
139
139
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' ])
141
141
142
142
if output == "" :
143
- mylog ('verbose ' , [f'[{ pluginName } ] Scan: FAIL - check logs' ])
143
+ mylog ('none ' , [f'[{ pluginName } ] Scan: FAIL - check logs' ])
144
144
else :
145
- mylog ('verbose ' , [f'[{ pluginName } ] Scan: SUCCESS' ])
145
+ mylog ('debug ' , [f'[{ pluginName } ] Scan: SUCCESS' ])
146
146
147
147
return ''
148
148
@@ -151,13 +151,13 @@ def ensure_avahi_running(attempt=1, max_retries=2):
151
151
"""
152
152
Ensure that D-Bus is running and the Avahi daemon is started, with recursive retry logic.
153
153
"""
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...' ])
155
155
156
156
# Check rc-status
157
157
try :
158
158
subprocess .run (['rc-status' ], check = True )
159
159
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 } ' ])
161
161
return
162
162
163
163
# Create OpenRC soft level
@@ -167,42 +167,42 @@ def ensure_avahi_running(attempt=1, max_retries=2):
167
167
try :
168
168
subprocess .run (['rc-update' , 'add' , 'avahi-daemon' ], check = True )
169
169
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 } ' ])
171
171
return
172
172
173
173
# Start the D-Bus service
174
174
try :
175
175
subprocess .run (['rc-service' , 'dbus' , 'start' ], check = True )
176
176
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 } ' ])
178
178
return
179
179
180
180
# Check Avahi status
181
181
status_output = subprocess .run (['rc-service' , 'avahi-daemon' , 'status' ], capture_output = True , text = True )
182
182
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.' ])
184
184
return
185
185
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 } )' ])
187
187
188
188
# Start the Avahi daemon
189
189
try :
190
190
subprocess .run (['rc-service' , 'avahi-daemon' , 'start' ], check = True )
191
191
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 } ' ])
193
193
194
194
# Check status after starting
195
195
status_output = subprocess .run (['rc-service' , 'avahi-daemon' , 'status' ], capture_output = True , text = True )
196
196
if 'started' in status_output .stdout :
197
- mylog ('verbose ' , [f'[{ pluginName } ] Avahi Daemon successfully started.' ])
197
+ mylog ('debug ' , [f'[{ pluginName } ] Avahi Daemon successfully started.' ])
198
198
return
199
199
200
200
# Retry if not started and attempts are left
201
201
if attempt < max_retries :
202
- mylog ('verbose ' , [f'[{ pluginName } ] Retrying... ({ attempt + 1 } /{ max_retries } )' ])
202
+ mylog ('debug ' , [f'[{ pluginName } ] Retrying... ({ attempt + 1 } /{ max_retries } )' ])
203
203
ensure_avahi_running (attempt + 1 , max_retries )
204
204
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.' ])
206
206
207
207
# rc-update add avahi-daemon
208
208
# rc-service avahi-daemon status
0 commit comments