Issues (23)

backuppc_clone/command/BackupPreScanCommand.py (1 issue)

1
from backuppc_clone.DataLayer import DataLayer
2
from backuppc_clone.command.BaseCommand import BaseCommand
3
from backuppc_clone.helper.BackupScanner import BackupScanner
4
5
6 View Code Duplication
class BackupPreScanCommand(BaseCommand):
0 ignored issues
show
This code seems to be duplicated in your project.
Loading history...
7
    """
8
    Pre-scans a host backup
9
10
    backup-pre-scan
11
        {clone.cfg : The configuration file of the clone}
12
        {host      : The name of the host}
13
        {backup#   : The backup number}
14
    """
15
16
    # ------------------------------------------------------------------------------------------------------------------
17
    def _handle_command(self) -> None:
18
        """
19
        Executes the command.
20
        """
21
        host = self.argument('host')
22
        backup_no = int(self.argument('backup#'))
23
24
        self._io.title('Pre-Scanning Backup {}/{}'.format(host, backup_no))
25
26
        helper = BackupScanner(self._io)
27
        helper.pre_scan_directory(host, backup_no)
28
29
        DataLayer.instance.commit()
30
31
# ----------------------------------------------------------------------------------------------------------------------
32