Completed
Pull Request — master (#640)
by
unknown
03:00
created

populate_elb_health_check()   A

Complexity

Conditions 1

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
dl 0
loc 18
rs 9.4285
c 1
b 0
f 1
1
from boto.ec2.elb import HealthCheck
2
3
4
def get_listners(listener_string):
5
    listeners = listener_string.split('#')
6
    listener_list = []
7
8
    if len(listeners) == 0:
9
        listeners = listener_string
10
11
    for i in range(len(listeners)):
12
        values = listeners[i].split(',')
13
        tup = (int(values[0]), int(values[1]), values[2])
14
15
        listener_list.append(tup)
16
17
    return listener_list
18
19
20
def populate_elb_health_check(kwargs):
21
22
    healthy_threshold = kwargs['healthy_threshold']
23
    interval = kwargs['interval']
24
    unhealthy_threshold = kwargs['unhealthy_threshold']
25
    target_value = kwargs['target']
26
27
    health_check = HealthCheck(interval=int(healthy_threshold),
28
        healthy_threshold=int(interval),
29
        unhealthy_threshold=int(unhealthy_threshold),
30
        target=target_value)
31
32
    del kwargs['healthy_threshold']
33
    del kwargs['interval']
34
    del kwargs['unhealthy_threshold']
35
    del kwargs['target']
36
37
    kwargs['health_check'] = health_check
38