BackupDeleteCommand._handle_command()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 13
Code Lines 7

Duplication

Lines 13
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nop 1
dl 13
loc 13
rs 10
c 0
b 0
f 0
1
from backuppc_clone.DataLayer import DataLayer
2
from backuppc_clone.command.BaseCommand import BaseCommand
3
from backuppc_clone.helper.BackupDelete import BackupDelete
4
5
6 View Code Duplication
class BackupDeleteCommand(BaseCommand):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7
    """
8
    Deletes a host backup
9
10
    backup-delete
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('Deleting Backup {}/{}'.format(host, backup_no))
25
26
        helper = BackupDelete(self._io)
27
        helper.delete_backup(host, backup_no)
28
29
        DataLayer.instance.commit()
30
31
# ----------------------------------------------------------------------------------------------------------------------
32