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

StopNodeAction.run()   A

Complexity

Conditions 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 2
dl 0
loc 9
rs 9.6666
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