Completed
Push — master ( a3e8d9...aa8f16 )
by Lakshmi
02:09
created

AddHostsAction.run()   B

Complexity

Conditions 7

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 7
dl 0
loc 11
rs 7.3333
1
from lib.base import QualysBaseAction
2
3
__all__ = [
4
    'AddHostsAction'
5
]
6
7
8
class AddHostsAction(QualysBaseAction):
9
    def run(self, hosts, vulnerability_management, policy_compliance):
10
        if policy_compliance and vulnerability_management:
11
            host_type = 'both'
12
        elif policy_compliance and not vulnerability_management:
13
            host_type = 'pc'
14
        elif not policy_compliance and vulnerability_management:
15
            host_type = 'vm'
16
        else:
17
            host_type = ''
18
        hosts = self.connection.addHost(str.join(',', hosts), host_type)
19
        return self.resultsets.formatter(hosts)
20