backuppc_clone.command.HostDeleteCommand   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A HostDeleteCommand._handle_command() 0 12 1
1
from backuppc_clone.DataLayer import DataLayer
2
from backuppc_clone.command.BaseCommand import BaseCommand
3
from backuppc_clone.helper.HostDelete import HostDelete
4
5
6
class HostDeleteCommand(BaseCommand):
7
    """
8
    Deletes all backups and metadata of a host
9
10
    host-delete
11
        {clone.cfg : The configuration file of the clone}
12
        {host      : The name of the host}
13
    """
14
15
    # ------------------------------------------------------------------------------------------------------------------
16
    def _handle_command(self) -> None:
17
        """
18
        Executes the command.
19
        """
20
        host = self.argument('host')
21
22
        self._io.title('Deleting Host {}'.format(host))
23
24
        helper = HostDelete(self._io)
25
        helper.delete_host(host)
26
27
        DataLayer.instance.commit()
28
29
# ----------------------------------------------------------------------------------------------------------------------
30