Ticket #15: lrs_backuppc_admin_tasks2.diff

File lrs_backuppc_admin_tasks2.diff, 12.6 kB (added by adam.cecile@linbox.com, 1 year ago)

New version (handle groups and profiles)

  • webmin/lbs/admin.cgi

    old new  
    109109    <ul><li><a href='rename.cgi?$redir'>$text{'but_rename'}</a> 
    110110    <li><a href='renamemac.cgi?$redir'>$text{'but_renamemac'}</a> 
    111111    <li><a href='delete.cgi?$redir'>$text{'but_delete'}</a> 
     112    <li><a href='disable_backuppc.cgi?$redir'>$text{'but_disable_backuppc'}</a> 
     113    <li><a href='delete_backuppc.cgi?$redir'>$text{'but_delete_backuppc'}</a> 
    112114    </ul> 
    113115EOF 
    114116} else { 
  • webmin/lbs/delete_backuppc.cgi

    old new  
     1#!/usr/bin/perl -w 
     2# 
     3# $Id: delete.cgi 4244 2007-04-16 09:10:48Z root $ 
     4# 
     5# Linbox Rescue Server 
     6# Copyright (C) 2005  Linbox FAS 
     7# 
     8# This program is free software; you can redistribute it and/or 
     9# modify it under the terms of the GNU General Public License 
     10# as published by the Free Software Foundation; either version 2 
     11# of the License, or (at your option) any later version. 
     12# 
     13# This program is distributed in the hope that it will be useful, 
     14# but WITHOUT ANY WARRANTY; without even the implied warranty of 
     15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     16# GNU General Public License for more details. 
     17# 
     18# You should have received a copy of the GNU General Public License 
     19# along with this program; if not, write to the Free Software 
     20# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
     21 
     22use strict; 
     23 
     24# rmtree function 
     25use File::Path; 
     26 
     27# get some common functions ... 
     28require "lbs.pl"; 
     29# ... and vars 
     30use vars qw (%access %config %in %text $VERSION); 
     31 
     32lbs_common::init_lbs_conf() or exit(0); 
     33 
     34my %einfo; 
     35my $lbs_home = $lbs_common::lbsconf{'basedir'}; 
     36my $etherfile = $lbs_home . "/etc/ether"; 
     37my ($mac,$name); 
     38my ($mesg, $warning); 
     39my $result; 
     40my @toremove; 
     41 
     42error(text("err_dnf",$lbs_home)) if (not -d $lbs_home); 
     43error(text("err_fnf",$etherfile)) if (not -f $etherfile); 
     44 
     45ReadParse(); 
     46lbs_common::InClean(); 
     47 
     48# Is the user granted to do this action ? 
     49error( $text{'acl_error'} ) if ($access{'modify'}); 
     50 
     51etherLoad($etherfile, \%einfo) or error( lbsGetError() ); 
     52 
     53# Invalid MAC address 
     54if (not exists $in{'mac'}) { 
     55        error($text{'err_invalcgi_nomac'}); 
     56} 
     57# Seems the users clicked on cancel, redirect to index 
     58elsif (exists $in{'cancel'}) { 
     59        redirect("index.cgi"); 
     60} 
     61# Yeah! Finally someone confirmed his choice, let's delete stuff 
     62elsif (exists $in{'apply'}) { 
     63 
     64    $mac = $in{'mac'}; 
     65    $name = etherGetNameByMac(\%einfo, $mac); 
     66    # Strip profile 
     67    $name =~ s/^.*://; 
     68    # Strip group(s) 
     69    $name =~ s/^.*\///; 
     70    # StrToLower 
     71    $name = lc($name); 
     72         
     73    if (not defined $name) { 
     74        error(text("err_mac_inval",$mac)); 
     75    } 
     76         
     77    # Drop BackupPC config plus old backups 
     78    # BackupPC_nightly will remove old files from cpool at its next run 
     79    my $BACKUPPCCONFDIR="/etc/backuppc";            # FIXME: hardcoded 
     80    my $BACKUPPCFILESDIR="/var/lib/backuppc/pc";    # FIXME: hardcoded 
     81 
     82    # Create an array with all we want to delete 
     83    push @toremove, "$BACKUPPCCONFDIR/$name.pl" if (-e "$BACKUPPCCONFDIR/$name.pl"); 
     84    push @toremove, "$BACKUPPCFILESDIR/$name" if (-e "$BACKUPPCFILESDIR/$name"); 
     85    # And remove it, then 
     86    foreach (@toremove) { 
     87        rmtree($_, 0, 1); 
     88    } 
     89     
     90    # We need to fix /etc/backuppc/hosts too 
     91    `perl -i -ne "print unless m/^$name\\s+[0-9]/i" $BACKUPPCCONFDIR/hosts`; 
     92 
     93    # And reload BackupPC to re-read hosts 
     94    `/etc/init.d/backuppc reload`; 
     95 
     96    $mesg = text("msg_delete_ok",$name,$mac); 
     97    lbs_common::print_header( $text{'tit_delete'}, "index", $VERSION); 
     98    lbs_common::print_html_tabs(['list_of_machines', "clients_list"]); 
     99 
     100    print "<h2>$mesg</h2>\n" ; 
     101 
     102    menuEnd(); 
     103    footer("", $text{'index'}) ; 
     104} 
     105 
     106# No confirmation asked yet, let's bother the user 
     107else { 
     108         
     109        $mac = $in{'mac'} ; 
     110        $name = etherGetNameByMac(\%einfo, $mac) ; 
     111 
     112        lbs_common::print_header( $text{'tit_delete'}, "index", $VERSION); 
     113        lbs_common::print_html_tabs(['list_of_machines', "clients_list"]); 
     114 
     115        $mesg = text("msg_delete_confirm_backuppc",$name,$mac); 
     116        $warning = $text{'msg_delete_warn_backuppc'} ; 
     117        print_confirmation_form("delete_backuppc.cgi", "<h2>$mesg<br><font color=#FF0000>$warning</font></h2>", "mac", $mac ) ; 
     118 
     119        # end of tabs 
     120        lbs_common::print_end_menu(); 
     121        lbs_common::print_end_menu(); 
     122 
     123        # end of page 
     124        footer( "", $text{'index'} ); 
     125} 
  • webmin/lbs/disable_backuppc.cgi

    old new  
     1#!/usr/bin/perl -w 
     2# 
     3# $Id: delete.cgi 4244 2007-04-16 09:10:48Z root $ 
     4# 
     5# Linbox Rescue Server 
     6# Copyright (C) 2005  Linbox FAS 
     7# 
     8# This program is free software; you can redistribute it and/or 
     9# modify it under the terms of the GNU General Public License 
     10# as published by the Free Software Foundation; either version 2 
     11# of the License, or (at your option) any later version. 
     12# 
     13# This program is distributed in the hope that it will be useful, 
     14# but WITHOUT ANY WARRANTY; without even the implied warranty of 
     15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     16# GNU General Public License for more details. 
     17# 
     18# You should have received a copy of the GNU General Public License 
     19# along with this program; if not, write to the Free Software 
     20# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
     21 
     22use strict; 
     23 
     24# get some common functions ... 
     25require "lbs.pl"; 
     26# ... and vars 
     27use vars qw (%access %config %in %text $VERSION); 
     28 
     29lbs_common::init_lbs_conf() or exit(0); 
     30 
     31my %einfo; 
     32my $lbs_home = $lbs_common::lbsconf{'basedir'}; 
     33my $etherfile = $lbs_home . "/etc/ether"; 
     34my ($mac,$name); 
     35my ($mesg, $warning); 
     36my $result; 
     37 
     38error(text("err_dnf",$lbs_home)) if (not -d $lbs_home); 
     39error(text("err_fnf",$etherfile)) if (not -f $etherfile); 
     40 
     41ReadParse(); 
     42lbs_common::InClean(); 
     43 
     44# Is the user granted to do this action ? 
     45error( $text{'acl_error'} ) if ($access{'modify'}); 
     46 
     47etherLoad($etherfile, \%einfo) or error( lbsGetError() ); 
     48 
     49# Invalid MAC address 
     50if (not exists $in{'mac'}) { 
     51        error($text{'err_invalcgi_nomac'}); 
     52} 
     53# Seems the users clicked on cancel, redirect to index 
     54elsif (exists $in{'cancel'}) { 
     55        redirect("index.cgi"); 
     56} 
     57# Yeah! Finally someone confirmed his choice, let's disable the host 
     58elsif (exists $in{'apply'}) { 
     59 
     60    $mac = $in{'mac'}; 
     61    $name = etherGetNameByMac(\%einfo, $mac); 
     62    # Strip profile 
     63    $name =~ s/^.*://; 
     64    # Strip group(s) 
     65    $name =~ s/^.*\///; 
     66    # StrToLower 
     67    $name = lc($name); 
     68 
     69    if (not defined $name) { 
     70        error(text("err_mac_inval",$mac)); 
     71    } 
     72         
     73    # Modify host's BackupPC conf file 
     74    my $BACKUPPCCONFDIR="/etc/backuppc";            # FIXME: hardcoded 
     75    my $BACKUPPCCONFFILE="$BACKUPPCCONFDIR/$name.pl"; 
     76 
     77    # Set $Conf{FullPeriod} to -1 
     78    `perl -pi -e 's/\\\$Conf{FullPeriod}.*\$/\\\$Conf{FullPeriod} = -1;/' $BACKUPPCCONFFILE`; 
     79 
     80    $mesg = text("msg_disable_backuppc_ok",$name,$mac); 
     81    lbs_common::print_header( $text{'tit_disable_backuppc'}, "index", $VERSION); 
     82    lbs_common::print_html_tabs(['list_of_machines', "clients_list"]); 
     83 
     84    print "<h2>$mesg</h2>\n"; 
     85     
     86    menuEnd(); 
     87    footer("", $text{'index'}); 
     88} 
     89 
     90# No confirmation asked yet, let's bother the user 
     91else { 
     92         
     93        $mac = $in{'mac'} ; 
     94        $name = etherGetNameByMac(\%einfo, $mac) ; 
     95 
     96        lbs_common::print_header( $text{'tit_disable_backuppc'}, "index", $VERSION); 
     97        lbs_common::print_html_tabs(['list_of_machines', "clients_list"]); 
     98 
     99        $mesg = text("msg_disable_confirm_backuppc",$name,$mac); 
     100        $warning = $text{'msg_disable_warn_backuppc'} ; 
     101        print_confirmation_form("disable_backuppc.cgi", "<h2>$mesg<br><font color=#FF0000>$warning</font></h2>", "mac", $mac ) ; 
     102 
     103        # end of tabs 
     104        lbs_common::print_end_menu(); 
     105        lbs_common::print_end_menu(); 
     106 
     107        # end of page 
     108        footer( "", $text{'index'} ); 
     109} 
  • webmin/lbs/lang/en

    old new  
    2020but_return=Return 
    2121but_rm_machine=Remove this client 
    2222but_sync=Synchronize 
     23but_disable_backuppc=Disable files backup 
     24but_delete_backuppc=Delete files backup 
    2325 
    2426err_adminid_mandat=The admin ID is mandatory. 
    2527err_basedirnf=LRS root directory <b>$1</b> not found. You should check <tt>basedir</tt> located into <tt>lbs.conf</tt> . 
     
    166168msg_conf_partcopy=Partition $1, disk $2 ($3) 
    167169msg_conf_ptabs=Disk $1 partition table 
    168170msg_delete_confirm=Remove host <b>$1</b> ($2) ? 
     171msg_delete_confirm_backuppc=Remove host <b>$1</b> ($2) from files backups ? 
    169172msg_delete_ok=Host <b>$1</b> ($2) successfully removed. 
    170173msg_delete_warn=WARNING: All information about this host will be deleted, including backups ! 
     174msg_delete_warn_backuppc=WARNING: All information about this host files backups will be deleted, including backups ! 
    171175msg_delimg_confirm=Remove image <b>$1</b> ? 
    172176msg_delimg_symlink=This image is just a link to one another. Only this link will be deleted. 
    173177msg_delimg_warn=WARNING: All data about this image will be deleted! 
    174178msg_dhcp_addofentry=Add of entry 
    175179msg_dhcp_formdesc=Add a new host entry in the LRS for system backup 
    176180msg_dhcp_nolic=Sorry, you cannot add more clients. License exhausted. 
     181msg_disable_backuppc_ok=Files backups disabled sucessfully for host <b>$1</b> ($2). 
     182msg_disable_confirm_backuppc=Disable files backups for host <b>$1</b> ($2) ? 
     183msg_disable_warn_backuppc=WARNING: No more automatic files backups will be done. Current backups will stay available. 
    177184msg_imgbase_delconfirm=Remove image <b>$1</b> ? 
    178185msg_imgbase_delwarn=WARNING: All data about this image will be deleted! 
    179186msg_index_empty=No registered host. 
     
    206213tit_desc=LRS : Description Edition 
    207214tit_details=LRS : Details 
    208215tit_dhcp=LRS : DHCP 
     216tit_disable_backuppc=LRS: Disable files backup 
    209217tit_error=LRS : Error 
    210218tit_hwinfo=LRS : Hardware Config 
    211219tit_imagesize=Compressed image size (in MB) 
  • webmin/lbs/lang/fr

    old new  
    2020but_return=Retour 
    2121but_rm_machine=Effacer cette machine 
    2222but_sync=Synchroniser 
     23but_disable_backuppc=Désactiver la sauvegarde fichiers 
     24but_delete_backuppc=Supprimer de la sauvegarde fichiers 
    2325 
    2426err_adminid_mandat=Le mot de passe d'identification est obligatoire. 
    2527err_basedirnf=Le répertoire racine LRS <b>$1</b> est inaccessible. Veuillez vérifier le paramètre <tt>basedir</tt> dans le fichier <tt>lbs.conf</tt> . 
     
    167169msg_conf_partcopy=Partition $1, disque $2 ($3) 
    168170msg_conf_ptabs=Table de partitions du disque $1 
    169171msg_delete_confirm=Effacer la machine <b>$1</b> ($2) ? 
     172msg_delete_confirm_backuppc=Effacer la machine <b>$1</b> ($2) de la sauvegarde fichiers ? 
    170173msg_delete_ok=Effacement de la machine <b>$1</b> ($2) effectué avec succès. 
    171174msg_delete_warn=ATTENTION: cela effacera toutes les données concernant cette machine. Y compris ses sauvegardes! 
     175msg_delete_warn_backuppc=ATTENTION: cela effacera toutes les données concernant la sauvegarde fichiers de cette machine. Y compris ses sauvegardes! 
    172176msg_delimg_confirm=Effacer l'image <b>$1</b> ? 
    173177msg_delimg_symlink=Cette image est juste un lien vers une autre image. Seul le lien lui-même sera effacé. 
    174178msg_delimg_warn=ATTENTION: cela effacera toutes les données concernant cette image! 
    175179msg_dhcp_addofentry=Ajout de l'entrée 
    176180msg_dhcp_formdesc=Ajout d'une nouveau client LRS pour la sauvegarde système 
    177181msg_dhcp_nolic=Désolé, vous ne pouvez plus ajouter d'autres clients. Pas assez de licences. 
     182msg_disable_backuppc_ok=Sauvegarde fichiers désactivée avec succès pour la machine <b>$1</b> ($2). 
     183msg_disable_confirm_backuppc=Désactiver la sauvegarde fichiers de <b>$1</b> ($2) ? 
     184msg_disable_warn_backuppc=ATTENTION: Plus aucune sauvegarde ne sera effectuée automatiquement. Par contres, les sauvegardes actuelles resteront disponibles. 
    178185msg_imgbase_delconfirm=Effacer l'image <b>$1</b> ? 
    179186msg_imgbase_delwarn=ATTENTION: Cela effacera toutes les données concernant cette image ! 
    180187msg_index_empty=Aucune machine enregistrée 
     
    207214tit_desc=LRS : Edition de description 
    208215tit_details=LRS : Détails 
    209216tit_dhcp=LRS : DHCP 
     217tit_disable_backuppc=LRS: Désactivation sauvegarde fichiers 
    210218tit_error=LRS : Erreur 
    211219tit_hwinfo=LRS : Config matérielle 
    212220tit_imagesize=Taille de l'image compressée (en Mo)