Completed
Pull Request — master (#429)
by Tomaz
03:32
created

RestartNodeAction   A

Complexity

Total Complexity 2

Size/Duplication

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

1 Method

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