diff -urN smeserver-manager-0.1.0.old/createlinks smeserver-manager-0.1.0/createlinks --- smeserver-manager-0.1.0.old/createlinks 2020-10-05 19:24:31.000000000 +0400 +++ smeserver-manager-0.1.0/createlinks 2020-10-07 11:23:22.082000000 +0400 @@ -34,8 +34,11 @@ "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith"); } +safe_symlink("restart", + "root/etc/e-smith/events/smanager-refresh/services2adjust/smanager"); + # actions to perform -for my $event ( qw( smanager-update bootstrap-console-save ) ) +for my $event ( qw( smanager-update smanager-refresh bootstrap-console-save ) ) { event_link('navigation2-conf', "$event", '80'); event_link('routes2-conf', "$event", '80'); diff -urN smeserver-manager-0.1.0.old/root/usr/share/smanager/lib/SrvMngr/Controller/Yum.pm smeserver-manager-0.1.0/root/usr/share/smanager/lib/SrvMngr/Controller/Yum.pm --- smeserver-manager-0.1.0.old/root/usr/share/smanager/lib/SrvMngr/Controller/Yum.pm 2020-08-26 17:45:36.000000000 +0400 +++ smeserver-manager-0.1.0/root/usr/share/smanager/lib/SrvMngr/Controller/Yum.pm 2020-10-07 17:32:48.466000000 +0400 @@ -17,7 +17,6 @@ use SrvMngr qw(theme_list init_session ip_number_or_blank); use esmith::ConfigDB; -use esmith::AccountsDB; use esmith::util; use File::Basename; @@ -53,16 +52,12 @@ $yum_datas{'trt'} = 'STAT'; - if (-e "/var/run/yum.pid") { + if ( -e "/var/run/yum.pid" ) { $yum_datas{'trt'} = 'LOGF'; - #$dest = 'yumlogfile'; - $c->stash( title => $title, notif => $notif, yum_datas => \%yum_datas ); - return $c->redirect_to("/yumd"); - } elsif ($c->get_prop('yum', 'LogFile')) { + $dest = 'yumlogfile'; + } elsif ($cdb->get_prop('yum', 'LogFile')) { $yum_datas{'trt'} = 'PSTU'; - #$dest = 'yumpostupg'; - $c->stash( title => $title, notif => $notif, yum_datas => \%yum_datas ); - return $c->redirect_to("/yumd"); + $dest = 'yumpostupg'; } else { # normal other trt } @@ -86,6 +81,13 @@ $yum_datas{'trt'} = $trt; + # force $trt if current logfile + if ( -e "/var/run/yum.pid" ) { + $trt = 'LOGF'; + } elsif ($cdb->get_prop('yum', 'LogFile')) { + $trt = 'PSTU'; + } + if ( $trt eq 'UPDT' ) { $dest = 'yumupdate'; } @@ -109,12 +111,12 @@ } if ( $trt eq 'PSTU') { - if ($c->get_prop('yum', 'LogFile')) { + if ($cdb->get_prop('yum', 'LogFile')) { $dest = 'yumpostupg'; } } - if ( $dest eq '' ) { $dest = 'yum'; } + if ( ! $dest ) { $dest = 'yum'; } $c->stash( title => $title, notif => $notif, yum_datas => \%yum_datas ); return $c->render( template => $dest ); @@ -140,20 +142,13 @@ if ( $trt eq 'UPDT' ) { $dest = 'yumupdate'; -# $yum_datas{xxx} = $c->param('XXX'); - - # controls -# $res = xxxxxxx( $c ); -# $result .= $res unless $res eq 'OK'; - - #$result .= 'Blocked for testing !'; if ( ! $result ) { $res = $c->do_yum('update'); $result .= $res unless $res eq 'OK'; if ( ! $result ) { $yum_datas{trt} = 'SUC'; - $result = $c->l('yum_SUCCESS'); + #$result = $c->l('yum_SUCCESS'); } } } @@ -161,20 +156,13 @@ if ( $trt eq 'INST' ) { $dest = 'yuminstall'; -# $yum_datas{xxx} = $c->param('XXX'); - - # controls -# $res = zzzzzz( $c ); -# $result .= $res unless $res eq 'OK'; - - #$result .= 'Blocked for testing !'; if ( ! $result ) { $res = $c->do_yum('install'); $result .= $res unless $res eq 'OK'; if ( ! $result ) { $yum_datas{trt} = 'SUC'; - $result = $c->l('yum_SUCCESS'); + #$result = $c->l('yum_SUCCESS'); } } } @@ -182,20 +170,13 @@ if ( $trt eq 'REMO' ) { $dest = 'yumremove'; -# $yum_datas{xxx} = $c->param('XXX'); - - # controls -# $res = yyyyyyyyy( $c ); -# $result .= $res unless $res eq 'OK'; - - #$result .= 'Blocked for testing !'; if ( ! $result ) { - $res = $c->do_yum('config'); + $res = $c->do_yum('remove'); $result .= $res unless $res eq 'OK'; if ( ! $result ) { $yum_datas{trt} = 'SUC'; - $result = $c->l('yum_SUCCESS'); + #$result = $c->l('yum_SUCCESS'); } } } @@ -203,13 +184,6 @@ if ( $trt eq 'CONF' ) { $dest = 'yumconfig'; -# $yum_datas{xxx} = $c->param('XXX'); - - # controls -# $res = $c->zzzz( $c->param('ZZZZ') ); -# $result .= $res . ' DMS ' unless $res eq 'OK'; - -# $result .= 'Blocked for testing !'; if ( ! $result ) { $res = $c->change_settings(); @@ -239,36 +213,29 @@ $dest = 'yumlogfile'; if ( ! -e "/var/run/yum.pid") { $yum_datas{trt} = 'SUC'; + $result = $c->l('yum_SUCCESS'); } } + # do_yum ended (no message) --> forced to LOGFile + if ( ! $result ) { + $dest = 'yumlogfile'; + $yum_datas{trt} = 'LOGF'; + } $c->stash( title => $title, notif => $result, yum_datas => \%yum_datas ); if ($yum_datas{trt} ne 'SUC') { return $c->render(template => $dest); } - $c->redirect_to("/yum"); - -}; + my $message = "'Yum' $trt update DONE"; + $c->app->log->info($message); + $c->flash(success => $result) if $result; -sub get_prop { - my ($c, $item, $prop, $default) = @_; - warn "You must specify a record key" unless $item; - warn "You must specify a property name" unless $prop; - my $record = $cdb->get($item) or warn "Couldn't get record for $item"; - my $value = $record ? $record->prop($prop) : undef; - return defined $value ? $value : $default; -} - + $c->redirect_to("/yum"); -sub get_value { - my ($c,$item,$default) = @_; - my $record = $cdb->get($item) or warn "Couldn't get record for $item"; - my $value = $record ? $record->value() : undef; - return defined $value ? $value : $default; -} +}; sub is_empty { @@ -513,7 +480,9 @@ esmith::util::backgroundCommand(0, "/sbin/e-smith/signal-event", "yum-$function"); - $cdb->reload; + for ( qw(available installed updates) ) { + $dbs{$_}->reload; + } return 'OK'; } @@ -522,7 +491,6 @@ sub get_yum_status_page { my ($c) = @_; - my $yum_status; open(YUM_STATUS, "reload; - my $out .= sprintf "
";
+    my $filepage = $cdb->get_prop('yum', 'LogFile');
+    return '' unless $filepage and ( -e "$filepage" );
 
+    my $out = sprintf "
";
     open (FILE, "$filepage");
     while () {
 	$out .= sprintf("%s", $_);
     }
     close FILE;
-    
     $out .= sprintf "
"; + undef $filepage; return $out; } -sub format_yum_log { - - my ($c) = @_; - - my $yum_log = $cdb->get_prop('yum', 'LogFile'); - - return $c->show_file_page($yum_log); - -} - - sub post_upgrade_reboot { my $c = shift; @@ -582,13 +540,9 @@ sub show_yum_log { - my $c = shift; - my $out = $c->format_yum_log(); - my $yum_log = $cdb->get_prop_and_delete('yum', 'LogFile'); - return $out; } diff -urN smeserver-manager-0.1.0.old/root/usr/share/smanager/lib/SrvMngr.pm smeserver-manager-0.1.0/root/usr/share/smanager/lib/SrvMngr.pm --- smeserver-manager-0.1.0.old/root/usr/share/smanager/lib/SrvMngr.pm 2020-10-05 17:59:59.000000000 +0400 +++ smeserver-manager-0.1.0/root/usr/share/smanager/lib/SrvMngr.pm 2020-10-07 11:54:23.345000000 +0400 @@ -23,7 +23,7 @@ use SrvMngr::Model::Main; -our $VERSION = '1.030'; +our $VERSION = '1.031'; $VERSION = eval $VERSION; use Exporter 'import'; diff -urN smeserver-manager-0.1.0.old/root/usr/share/smanager/themes/default/templates/layouts/default.html.ep smeserver-manager-0.1.0/root/usr/share/smanager/themes/default/templates/layouts/default.html.ep --- smeserver-manager-0.1.0.old/root/usr/share/smanager/themes/default/templates/layouts/default.html.ep 2020-08-08 18:57:00.000000000 +0400 +++ smeserver-manager-0.1.0/root/usr/share/smanager/themes/default/templates/layouts/default.html.ep 2020-10-04 19:44:44.000000000 +0400 @@ -13,6 +13,7 @@ %= stylesheet '/css/styles.css' %= include 'partials/_js_imports' %= include 'common_js' + %= content_for 'refresh' diff -urN smeserver-manager-0.1.0.old/root/usr/share/smanager/themes/default/templates/partials/_footer.html.ep smeserver-manager-0.1.0/root/usr/share/smanager/themes/default/templates/partials/_footer.html.ep --- smeserver-manager-0.1.0.old/root/usr/share/smanager/themes/default/templates/partials/_footer.html.ep 2020-08-08 18:57:00.000000000 +0400 +++ smeserver-manager-0.1.0/root/usr/share/smanager/themes/default/templates/partials/_footer.html.ep 2020-10-07 18:25:56.521000000 +0400 @@ -1,8 +1,8 @@