|
1 | 1 | import os |
2 | | -import shutil |
3 | 2 | import logging |
| 3 | +import time |
4 | 4 | from typing import Union, List, Optional |
5 | 5 |
|
6 | 6 | from openbrokerapi.catalog import ServicePlan |
|
18 | 18 | from .database.query import get_instance_path, get_chart_path, get_plan_path, \ |
19 | 19 | get_addon_updateable, get_addon_bindable, get_addon_allow_params, \ |
20 | 20 | get_addon_archive, get_binding_file, get_instance_file |
21 | | -from .database.metadata import load_instance_meta, load_binding_meta, load_addons_meta |
| 21 | +from .database.metadata import load_instance_meta, load_binding_meta, load_addons_meta, \ |
| 22 | + save_instance_meta |
22 | 23 | from .tasks import provision, bind, deprovision, update, unbind |
23 | 24 |
|
24 | 25 | logger = logging.getLogger(__name__) |
@@ -94,9 +95,6 @@ def bind(self, |
94 | 95 | instance_path = get_instance_path(instance_id) |
95 | 96 | if os.path.exists(f'{instance_path}/bind.json'): |
96 | 97 | raise ErrBindingAlreadyExists() |
97 | | - chart_path, plan_path = ( |
98 | | - get_chart_path(instance_id), get_plan_path(instance_id)) |
99 | | - shutil.copy(f'{plan_path}/bind.yaml', f'{chart_path}/templates') |
100 | 98 | bind(instance_id, binding_id, details, async_allowed, **kwargs) |
101 | 99 | data = load_binding_meta(instance_id) |
102 | 100 | if data["last_operation"]["state"] == OperationState.SUCCEEDED.value: |
@@ -145,6 +143,11 @@ def update(self, |
145 | 143 | if details.plan_id is not None: |
146 | 144 | chart_path, plan_path = get_chart_path(instance_id), get_plan_path(instance_id) |
147 | 145 | fetch_chart_plan(details.service_id, chart_path, details.plan_id, plan_path) |
| 146 | + data = load_instance_meta(instance_id) |
| 147 | + data['last_operation']["state"] = OperationState.IN_PROGRESS.value |
| 148 | + data['last_operation']["description"] = ( |
| 149 | + f"update {instance_id} in progress at {time.time()}") |
| 150 | + save_instance_meta(instance_id, data) |
148 | 151 | update.delay(instance_id, details) |
149 | 152 | return UpdateServiceSpec(is_async=True) |
150 | 153 |
|
|
0 commit comments