Skip to content

Commit b77239f

Browse files
committed
Fixing issue with hostmetrics agent where it can't restart logstash
1 parent 10435bd commit b77239f

File tree

6 files changed

+12
-3
lines changed

6 files changed

+12
-3
lines changed

psconfig/perfsonar-psconfig/Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ endif
3131
ifndef HTTPD-CONFIGPATH
3232
@echo No HTTPD-CONFIGPATH specified for installation
3333
@false
34+
endif
35+
ifndef SUDOERSDPATH
36+
@echo No SUDOERSDPATH specified for installation
37+
@false
3438
endif
3539
python3 setup.py install --root=${PYTHON-ROOTPATH} -O1 --record=INSTALLED_FILES
3640
mkdir -p ${PERFSONAR-ROOTPATH}/bin/commands
@@ -39,12 +43,14 @@ endif
3943
mkdir -p ${PERFSONAR-DATAPATH}
4044
mkdir -p ${BINPATH}
4145
mkdir -p ${HTTPD-CONFIGPATH}
46+
mkdir -p ${SUDOERSDPATH}
4247
install -m 0755 bin/psconfig* ${PERFSONAR-ROOTPATH}/bin
4348
ln -fs /usr/lib/perfsonar/psconfig/bin/psconfig ${BINPATH}/psconfig
4449
install -m 0755 bin/commands/* ${PERFSONAR-ROOTPATH}/bin/commands
4550
install -m 0644 templates/* ${PERFSONAR-ROOTPATH}/templates
4651
install -m 0644 etc/*.json ${PERFSONAR-CONFIGPATH}/
4752
install -m 0644 etc/*.conf ${PERFSONAR-CONFIGPATH}/
53+
install -m 0644 sudoers.d/* ${SUDOERSDPATH}/
4854
install -m 644 apache-psconfig-publisher.conf ${HTTPD-CONFIGPATH}/
4955

5056
clean:

psconfig/perfsonar-psconfig/psconfig/hostmetrics/agent.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def _run_end(self, agent_conf):
143143
}))
144144
# Restart service
145145
if agent_conf.restart_service():
146-
restart_result = subprocess.run(["systemctl", "restart", agent_conf.restart_service()])
146+
restart_result = subprocess.run(["sudo", "systemctl", "restart", agent_conf.restart_service()])
147147
if restart_result.returncode == 0:
148148
self.logger.debug(self.logf.format("Service {} restarted".format(agent_conf.restart_service())))
149149
else:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
perfsonar ALL=NOPASSWD: /bin/systemctl restart logstash

psconfig/perfsonar-psconfig/unibuild-packaging/deb/perfsonar-psconfig-pscheduler.install

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ usr/lib/perfsonar/psconfig/bin/psconfig_pscheduler_agent
22
usr/lib/perfsonar/psconfig/bin/commands/pscheduler-tasks
33
etc/perfsonar/psconfig/pscheduler-agent.json
44
etc/perfsonar/psconfig/pscheduler-agent-logger.conf
5+
etc/sudoers.d/psconfig-hostmetrics
56
systemd/psconfig-pscheduler-agent.service lib/systemd/system/

psconfig/perfsonar-psconfig/unibuild-packaging/deb/rules

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ override_dh_auto_build:
1414
override_dh_auto_test:
1515

1616
override_dh_install:
17-
make PYTHON-ROOTPATH=. PERFSONAR-CONFIGPATH=etc/perfsonar/psconfig PERFSONAR-ROOTPATH=usr/lib/perfsonar/psconfig PERFSONAR-DATAPATH=var/lib/perfsonar/psconfig BINPATH=usr/bin install HTTPD-CONFIGPATH=etc/apache2/conf-available
17+
make PYTHON-ROOTPATH=. PERFSONAR-CONFIGPATH=etc/perfsonar/psconfig PERFSONAR-ROOTPATH=usr/lib/perfsonar/psconfig PERFSONAR-DATAPATH=var/lib/perfsonar/psconfig BINPATH=usr/bin install HTTPD-CONFIGPATH=etc/apache2/conf-available SUDOERSDPATH=etc/sudoers.d
1818
dh_install

psconfig/perfsonar-psconfig/unibuild-packaging/rpm/perfsonar-psconfig.spec

+2-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ make -f /usr/share/selinux/devel/Makefile -C selinux psconfig-hostmetrics.pp
138138

139139
%install
140140
rm -rf %{buildroot}
141-
make install PYTHON-ROOTPATH=%{buildroot} PERFSONAR-CONFIGPATH=%{buildroot}/%{config_base} PERFSONAR-ROOTPATH=%{buildroot}/%{psconfig_base} PERFSONAR-DATAPATH=%{buildroot}/%{psconfig_datadir} BINPATH=%{buildroot}/%{_bindir} HTTPD-CONFIGPATH=%{buildroot}/%{httpd_config_base}
141+
make install PYTHON-ROOTPATH=%{buildroot} PERFSONAR-CONFIGPATH=%{buildroot}/%{config_base} PERFSONAR-ROOTPATH=%{buildroot}/%{psconfig_base} PERFSONAR-DATAPATH=%{buildroot}/%{psconfig_datadir} BINPATH=%{buildroot}/%{_bindir} HTTPD-CONFIGPATH=%{buildroot}/%{httpd_config_base} SUDOERSDPATH=%{buildroot}/etc/sudoers.d
142142
mkdir -p %{buildroot}/%{_unitdir}/
143143
install -m 644 systemd/* %{buildroot}/%{_unitdir}/
144144
mkdir -p %{buildroot}/usr/share/selinux/packages/
@@ -267,6 +267,7 @@ fi
267267
%attr(0644,root,root) /usr/share/selinux/packages/psconfig-hostmetrics.pp
268268
%{template_base}/prometheus-logstash-input.conf.j2
269269
%{_unitdir}/psconfig-hostmetrics-agent.service
270+
/etc/sudoers.d/psconfig-hostmetrics
270271

271272
%files utils
272273
%defattr(0644,perfsonar,perfsonar,0755)

0 commit comments

Comments
 (0)