HolgerHees / smartserver

SmartHome Server deployment setup
http://www.intranet-of-things.com/smarthome/infrastructure/server/setup/
GNU General Public License v3.0
27 stars 5 forks source link

system_update_check crash when system is recently updated #6

Closed toffee closed 2 years ago

toffee commented 2 years ago

Regarding https://github.com/HolgerHees/smartserver/blob/fb2da21aebb7453e5a22fdf068978c84ca575498/roles/update_daemon/templates/opt/update_daemon/plugins/os/opensuse.py#L14

On my system (recently updated) the output of command

/usr/bin/zypper ps -s

is:

No processes using deleted files found.

No core libraries or services have been updated since the last system boot.
Reboot is probably not necessary.

The following exception is thrown:

Traceback (most recent call last):
  File "/opt/update_daemon/system_update_check", line 31, in <module>
    repo = plugin.Repository()
  File "/opt/update_daemon/plugins/os/opensuse.py", line 19, in __init__
    self.needs_restart = m.group(0) is not None
AttributeError: 'NoneType' object has no attribute 'group'

For the moment I fixed this by this additional check:

self.needs_restart = False
if m is not None:
    self.needs_restart = m.group(0) is not None

but I'm not sure the logic is correct (needs_restart = False) as long the output says "Reboot is probably not necessary."

HolgerHees commented 2 years ago

Hi,

Nice to see that you are using my deployment. :-) I'm aware of this issues and it is already fixed locally and will be committed tomorrow. Sorry that I committed a broken version.

Currently I'm refactoring the whole role "update_check" to be much more. The next version will provide a nice web UI where you can update your base system, your smart server deployment or restart services which are recently updated.

But for that, you have to clean the old role deployment manually to eleminate leftovers. It is changed really a lot to. (crond, var, log, etc, htdocs/main/components...)

Btw. The first version work only on opensuse for now. Other distribution will follow soon

Best

Holger

HolgerHees commented 2 years ago

everything should work now. To migrate from the old "update_notifier" role to the new "update_daemon" please delete

toffee commented 2 years ago

Thank you very much for considering and fixing the issue. Much appreciated your effort to improve the whole deployment!