Skip to content

Commit

Permalink
Merge pull request #1527 from Zentyal/jag/dashboard-robust
Browse files Browse the repository at this point in the history
More robust dashboard agains widget and remoteservices errors
  • Loading branch information
jacalvo committed Aug 22, 2014
2 parents 16edb22 + 2c1184b commit 806f0aa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions main/core/ChangeLog
@@ -1,4 +1,5 @@
HEAD
+ More robust dashboard agains widget and remoteservices errors
+ Added missing use in hasManyViewer.mas
+ Only allow restore from backups from versions with the same two
first version numbers
Expand Down
24 changes: 18 additions & 6 deletions main/core/src/EBox/Dashboard/CGI/Index.pm
Expand Up @@ -68,7 +68,15 @@ sub masonParameters
my $widgets = {};
foreach my $name (@modNames) {
my $mod = $global->modInstance($name);
my $wnames = $mod->widgets();
my $wnames;
try {
$wnames = $mod->widgets();
} catch($ex) {
EBox::error("Error loading widgets from module $name: $ex");
}
if (not $wnames) {
next;
}
for my $wname (keys (%{$wnames})) {
my $fullname = "$name:$wname";
next if exists $widgetsToHide->{$fullname};
Expand Down Expand Up @@ -160,11 +168,15 @@ sub masonParameters
my $showMessage = 1;
my $rs = EBox::Global->modInstance('remoteservices');
if (defined ($rs) and $rs->subscriptionLevel() >= 0) {
$showMessage = 0;
# Re-check for changes
$rs->checkAdMessages();
my $rsMsg = $rs->adMessages();
push (@params, 'message' => $rsMsg) if ($rsMsg->{text});
try {
# Re-check for changes
$rs->checkAdMessages();
my $rsMsg = $rs->adMessages();
$showMessage = 0;
push (@params, 'message' => $rsMsg) if ($rsMsg->{text});
} catch($ex) {
EBox::error("Error loading messages from remoteservices: $ex");
}
}

if ($showMessage) {
Expand Down

0 comments on commit 806f0aa

Please sign in to comment.