forked from adragomir/dcos-commons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsdk_plan.py
31 lines (19 loc) · 887 Bytes
/
sdk_plan.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
'''Utilities relating to interaction with service plans'''
import dcos
import sdk_spin
import shakedown
def get_deployment_plan(service_name):
return get_plan(service_name, "deploy")
def get_sidecar_plan(service_name):
return get_plan(service_name, "sidecar")
def start_sidecar_plan(service_name, parameters=None):
start_plan(service_name, "sidecar", parameters)
def start_plan(service_name, plan, parameters=None):
return dcos.http.post("{}/v1/plans/{}/start".format(shakedown.dcos_service_url(service_name), plan),
json=parameters if parameters is not None else {})
def get_plan(service_name, plan):
def fn():
response = dcos.http.get("{}/v1/plans/{}".format(shakedown.dcos_service_url(service_name), plan))
response.raise_for_status()
return response
return sdk_spin.time_wait_return(lambda: fn())