Completed
Push — master ( 48b27b...9784f9 )
by Tomaz
22s
created

StopNodeAction   A

Complexity

Total Complexity 2

Size/Duplication

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 9 2
1
import json
2
3
import requests
4
5
from lib.base import OpscenterAction
6
7
8
class StopNodeAction(OpscenterAction):
9
    def run(self, node_ip, cluster_id=None, drain_node=True):
10
        if not cluster_id:
11
            cluster_id = self.cluster_id
12
13
        payload = {'drain_first': drain_node}
14
15
        url = self._get_full_url([cluster_id, 'ops', 'stop', node_ip])
16
17
        return requests.post(url, data=json.dumps(payload)).json()
18