Skip to content

Commit 5b425f4

Browse files
committed
T7528: only stop service if previously deployed
1 parent b3ebf8f commit 5b425f4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/conf_mode/service_monitoring_prometheus.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,14 @@ def apply(monitoring):
173173
# Reload systemd manager configuration
174174
call('systemctl daemon-reload')
175175
if not monitoring or 'node_exporter' not in monitoring:
176-
call(f'systemctl stop {node_exporter_systemd_service}')
176+
if os.path.isfile(node_exporter_service_file):
177+
call(f'systemctl stop {node_exporter_systemd_service}')
177178
if not monitoring or 'frr_exporter' not in monitoring:
178-
call(f'systemctl stop {frr_exporter_systemd_service}')
179+
if os.path.isfile(frr_exporter_service_file):
180+
call(f'systemctl stop {frr_exporter_systemd_service}')
179181
if not monitoring or 'blackbox_exporter' not in monitoring:
180-
call(f'systemctl stop {blackbox_exporter_systemd_service}')
182+
if os.path.isfile(blackbox_exporter_service_file):
183+
call(f'systemctl stop {blackbox_exporter_systemd_service}')
181184

182185
if not monitoring:
183186
return

0 commit comments

Comments
 (0)