Total Complexity | 3 |
Total Lines | 18 |
Duplicated Lines | 0 % |
1 | import json |
||
8 | class RestartClusterAction(OpscenterAction): |
||
9 | def run(self, cluster_id=None, drain_first=True, sleep_interval=60, |
||
10 | ips=None): |
||
11 | |||
12 | if not cluster_id: |
||
13 | cluster_id = self.cluster_id |
||
14 | |||
15 | url = self._get_full_url([cluster_id, 'ops', 'restart']) |
||
16 | |||
17 | payload = { |
||
18 | 'drain_first': drain_first, |
||
19 | 'sleep': sleep_interval, |
||
20 | } |
||
21 | |||
22 | if ips: |
||
23 | payload['ips'] = ips |
||
24 | |||
25 | return requests.post(url, data=json.dumps(payload)).json() |
||
26 |