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

AddHostsAction   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 12
Duplicated Lines 0 %
Metric Value
dl 0
loc 12
rs 10
wmc 7

1 Method

Rating   Name   Duplication   Size   Complexity  
B run() 0 11 7
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