it-novum / openitcockpit-agent-go

Cross-Platform Monitoring Agent for openITCOCKPIT written in Go
https://openitcockpit.io/download_agent/
Apache License 2.0
5 stars 2 forks source link

RPM package update removes systemd service #54

Closed exa-mk closed 3 years ago

exa-mk commented 3 years ago

Sorry for annoying again... ;)

Agent Mode:

Versions

Operating system CentOS, Fedora

Describe the bug Updating the agent via rpm repository removes the systemd service file:

[root@cmw701 ~]# systemctl status openitcockpit-agent.service
● openitcockpit-agent.service - openITCOCKPIT Monitoring Agent
   Loaded: loaded (/usr/lib/systemd/system/openitcockpit-agent.service; enabled; vendor preset: disabled)
   Active: active (running) since Di 2021-06-01 15:05:06 CEST; 6 days ago
     Docs: https://openitcockpit.io
 Main PID: 28143 (openitcockpit-a)
    Tasks: 13
   Memory: 20.7M
   CGroup: /system.slice/openitcockpit-agent.service
           └─28143 /usr/bin/openitcockpit-agent --config /etc/openitcockpit-agent/config.ini --log /var/log/openitcockpit-agent/agent.log
[root@cmw701 ~]# rpm -qa |grep openitcockpit
openitcockpit-agent-3.0.2-1.x86_64
[root@cmw701 ~]# yum update openitcockpit-agent
[...]
Downloading packages:
No Presto metadata available for oitc_agent-by-salt
openitcockpit-agent-3.0.3-1.x86_64.rpm                                                                                                                                           | 9.6 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Removed symlink /etc/systemd/system/multi-user.target.wants/openitcockpit-agent.service.
  Updating   : openitcockpit-agent-3.0.3-1.x86_64                                                                                                                                                   1/2 
warning: /etc/openitcockpit-agent/config.ini created as /etc/openitcockpit-agent/config.ini.rpmnew
Created symlink from /etc/systemd/system/multi-user.target.wants/openitcockpit-agent.service to /usr/lib/systemd/system/openitcockpit-agent.service.
Removed symlink /etc/systemd/system/multi-user.target.wants/openitcockpit-agent.service.
rm: cannot remove ‘/var/log/openitcockpit-agent’: Is a directory
  Cleanup    : openitcockpit-agent-3.0.2-1.x86_64                                                                                                                                                   2/2 
  Verifying  : openitcockpit-agent-3.0.3-1.x86_64                                                                                                                                                   1/2 
  Verifying  : openitcockpit-agent-3.0.2-1.x86_64                                                                                                                                                   2/2 

Updated:
  openitcockpit-agent.x86_64 0:3.0.3-1                                                                                                                                                                  

Complete!
[root@cmw701 ~]# systemctl status openitcockpit-agent.service
Unit openitcockpit-agent.service could not be found.
[root@cmw701 ~]# systemctl daemon-reload 
[root@cmw701 ~]# systemctl status openitcockpit-agent.service
Unit openitcockpit-agent.service could not be found.
[root@cmw701 ~]# ls -la /usr/bin/openitcockpit-agent
-rwxr-xr-x 1 root root 20776529  7. Jun 10:23 /usr/bin/openitcockpit-agent
[root@cmw701 ~]# rpm -qa |grep openitcockpit-agent
openitcockpit-agent-3.0.3-1.x86_64

To Reproduce see above

Expected behavior systemd service still available after package upgrade (as is properly works on deb based systems).

nook24 commented 3 years ago

Whoops, i accidentally closed this with my pull request comment

nook24 commented 3 years ago

This should be fixed with the version 3.0.5. https://github.com/it-novum/openitcockpit-agent-go/releases/tag/3.0.5

Unfortunately when updating to 3.0.5 rpm will execute the prerm script from the old 3.0.4 package witch will remove the systemd service again. But beyond 3.0.5 the issue should be resolved.

nook24 commented 3 years ago

@exa-mk when you update your RPM based systems from 3.0.5 to 3.0.6 this error should no longer occur

https://github.com/it-novum/openitcockpit-agent-go/releases/tag/3.0.6