db_sync_tool.sync   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 81
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 48
dl 0
loc 81
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B Sync.__init__() 0 64 2
1
#!/usr/bin/env python3
2
# -*- coding: future_fstrings -*-
3
"""
4
Sync script
5
"""
6
7
from db_sync_tool.utility import system, helper, info
8
from db_sync_tool.database import process
9
from db_sync_tool.remote import transfer, client as remote_client
10
11
12
class Sync:
13
    """
14
    Synchronize a target database from an origin system
15
    """
16
17
    def __init__(self,
0 ignored issues
show
best-practice introduced by
Too many arguments (17/5)
Loading history...
Comprehensibility introduced by
This function exceeds the maximum number of variables (17/15).
Loading history...
18
                 config_file=None,
19
                 verbose=False,
20
                 yes=False,
21
                 mute=False,
22
                 dry_run=False,
23
                 import_file=None,
24
                 dump_name=None,
25
                 keep_dump=None,
26
                 host_file=None,
27
                 clear=False,
28
                 force_password=False,
29
                 use_rsync=False,
30
                 use_rsync_options=None,
31
                 reverse=False,
32
                 config=None,
33
                 args=None):
34
        """
35
        Initialization
36
        :param config_file:
37
        :param verbose:
38
        :param yes:
39
        :param mute:
40
        :param dry_run:
41
        :param import_file:
42
        :param dump_name:
43
        :param keep_dump:
44
        :param host_file:
45
        :param clear:
46
        :param force_password:
47
        :param use_rsync:
48
        :param use_rsync_options:
49
        :param reverse:
50
        :param config:
51
        :param args:
52
        """
53
        if config is None:
54
            config = {}
55
56
        info.print_header(mute)
57
        system.check_args_options(
58
            config_file,
59
            verbose,
60
            yes,
61
            mute,
62
            dry_run,
63
            import_file,
64
            dump_name,
65
            keep_dump,
66
            host_file,
67
            clear,
68
            force_password,
69
            use_rsync,
70
            use_rsync_options,
71
            reverse
72
        )
73
        system.get_configuration(config, args)
74
        system.check_authorizations()
75
        process.create_origin_database_dump()
76
        transfer.transfer_origin_database_dump()
77
        process.import_database_dump()
78
        helper.clean_up()
79
        remote_client.close_ssh_clients()
80
        info.print_footer()
81