diff --git a/src/rockstor/smart_manager/data_collector.py b/src/rockstor/smart_manager/data_collector.py index c30d1a392..aee8babab 100644 --- a/src/rockstor/smart_manager/data_collector.py +++ b/src/rockstor/smart_manager/data_collector.py @@ -1,5 +1,5 @@ """ -Copyright (c) 2012-2016 RockStor, Inc. +Copyright (c) 2012-2017 RockStor, Inc. This file is part of RockStor. RockStor is free software; you can redistribute it and/or modify @@ -47,7 +47,7 @@ from smart_manager.models import Service # noqa E402 from system.services import service_status # noqa E402 from cli.api_wrapper import APIWrapper # noqa E402 -from system.pkg_mgmt import update_check # noqa E402 +from system.pkg_mgmt import (update_check, yum_check) # noqa E402 import logging # noqa E402 logger = logging.getLogger(__name__) @@ -933,6 +933,19 @@ def update_check(self): 'data': uinfo }) + def yum_updates(self): + + while self.start: + rc = yum_check() + data = {} + data['yum_updates'] = True if rc == 100 else False + self.emit('yum_updates', + { + 'key': 'sysinfo:yum_updates', + 'data': data + }) + gevent.sleep(20) + def prune_logs(self): while self.start: diff --git a/src/rockstor/system/pkg_mgmt.py b/src/rockstor/system/pkg_mgmt.py index 62aa7629e..cec19953c 100644 --- a/src/rockstor/system/pkg_mgmt.py +++ b/src/rockstor/system/pkg_mgmt.py @@ -210,3 +210,11 @@ def update_run(subscription=None): time.sleep(120) return out, err, rc + +def yum_check(): + # Query yum for updates and grab return code + # yum check-update retun code is 0 with no updates + # and 100 if at least 1 update available + out, err, rc = run_command([YUM, 'check-update'], throw=False) + + return rc