Skip to content

Commit

Permalink
Merge pull request #2081 from phillxnet/2071_openSUSE-use-zypper-for-…
Browse files Browse the repository at this point in the history
…install

[openSUSE] use zypper for package installs. Fixes #2071
  • Loading branch information
phillxnet authored Nov 13, 2019
2 parents ce3412f + 78a7f08 commit ec3903d
Show file tree
Hide file tree
Showing 6 changed files with 647 additions and 177 deletions.
15 changes: 9 additions & 6 deletions src/rockstor/smart_manager/data_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,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, yum_check) # noqa E402
from system.pkg_mgmt import (rockstor_pkg_update_check, pkg_update_check) # noqa E402
import distro
import logging # noqa E402
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -948,7 +948,7 @@ def update_storage_state(self):

def update_check(self):

uinfo = update_check()
uinfo = rockstor_pkg_update_check()
self.emit('software_update',
{
'key': 'sysinfo:software_update',
Expand All @@ -958,16 +958,19 @@ def update_check(self):
def yum_updates(self):

while self.start:
rc, packages = yum_check()
packages = pkg_update_check()
data = {}
data['yum_updates'] = True if rc == 100 else False
if packages: # Non empty lists are True.
data['yum_updates'] = True
else:
data['yum_updates'] = False
data['packages'] = packages
self.emit('yum_updates',
{
'key': 'sysinfo:yum_updates',
'data': data
})
gevent.sleep(1800)
gevent.sleep(1800) # 1800 seconds = 30 mins

def on_runyum(self, sid):

Expand All @@ -985,7 +988,7 @@ def launch_yum():
'data': data
})
except Exception as e:
logger.error('Unable to perform Yum Updates: %s'
logger.error('Unable to perform Package Updates: %s'
% e.__str__())
self.spawn(launch_yum, sid)

Expand Down
8 changes: 4 additions & 4 deletions src/rockstor/storageadmin/static/storageadmin/js/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ $(document).ready(function() {
}
};

var yum_updating = false; //global var to check if yum is updating
var yum_updating = false; //global var to check if yum/zypper are updating
var displayYumUpdates = function(data) {
if (typeof data.yum_updating != 'undefined' && !data.yum_updating) {
console.log('closing');
Expand All @@ -1133,7 +1133,7 @@ $(document).ready(function() {
}
if (data.yum_updates && !yum_updating) {
$('#yum-msg').fadeIn(0);
$('#yum-msg a').html('<i class="fa fa-rss" title="Available Yum Updates"></i>');
$('#yum-msg a').html('<i class="fa fa-rss" title="Updates available"></i>');
if ($('#yum_panels').is(':empty')) {
_.each(data.packages, function(pkg) {
var html = '';
Expand Down Expand Up @@ -1162,13 +1162,13 @@ $(document).ready(function() {
};

$('#yum-run').click(function(event) {
var run_update = confirm('Do you want to procede with yum updates?');
var run_update = confirm('Do you want to proceed with these updates?');
if (run_update) {
RockStorSocket.sysinfo.emit('runyum');
$('#yum_modal').modal('hide');
yum_updating = true;
$('#yum_panels').empty();
$('#yum-msg a').html('<i class="fa fa-rss" title="Yum is updating all packages"></i>');
$('#yum-msg a').html('<i class="fa fa-rss" title="Updating all packages"></i>');
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/rockstor/storageadmin/templates/storageadmin/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h3>Yum available updates</h3>
<h3>Available updates</h3>
</div>
<div class="modal-body" id="yumContent" style="overflow: auto; height: 350px;">
<div class="panel-group" id="yum_panels"></div>
Expand Down
6 changes: 3 additions & 3 deletions src/rockstor/storageadmin/views/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from django.db import transaction
from share_helpers import (sftp_snap_toggle, import_shares, import_snapshots)
from rest_framework_custom.oauth_wrapper import RockstorOAuth2Authentication
from system.pkg_mgmt import (auto_update, current_version, update_check,
from system.pkg_mgmt import (auto_update, current_version, rockstor_pkg_update_check,
update_run, auto_update_status)
from nfs_exports import NFSExportMixin
import logging
Expand Down Expand Up @@ -222,7 +222,7 @@ def post(self, request, command, rtcepoch=None):
status='active')
except UpdateSubscription.DoesNotExist:
pass
return Response(update_check(subscription=subo))
return Response(rockstor_pkg_update_check(subscription=subo))
except Exception as e:
e_msg = ('Unable to check update due to a system error: '
'({}).').format(e.__str__())
Expand All @@ -238,7 +238,7 @@ def post(self, request, command, rtcepoch=None):
if request.auth is None:
update_run()
else:
update_run(yum_update=True)
update_run(update_all_other=True)
return Response('Done')
except Exception as e:
e_msg = ('Update failed due to this exception: '
Expand Down
Loading

0 comments on commit ec3903d

Please sign in to comment.