Skip to content

Commit 46ede22

Browse files
committed
Merge branch 'main' of github.com:drycc/helmbroker into main
2 parents 6250f8e + cda8c4d commit 46ede22

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

rootfs/helmbroker/tasks.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def update(instance_id: str, details: UpdateDetails):
5757
},
5858
"last_operation": {
5959
"state": OperationState.IN_PROGRESS,
60-
"description": "%s in progress at %s" % (instance_id, time.time())
60+
"description": "update %s in progress at %s" % (instance_id, time.time())
6161
}
6262
}
6363
dump_instance_meta(instance_id, data)
@@ -79,24 +79,24 @@ def update(instance_id: str, details: UpdateDetails):
7979
status, output = command("helm", *args)
8080
if status != 0:
8181
data["last_operation"]["state"] = OperationState.FAILED
82-
data["last_operation"]["description"] = output
82+
data["last_operation"]["description"] = "update %s failed: %s" % (instance_id, output)
8383
else:
8484
data["last_operation"]["state"] = OperationState.SUCCEEDED
85-
data["last_operation"]["description"] = "succeeded at %s" % time.time()
85+
data["last_operation"]["description"] = "update %s succeeded at %s" % (instance_id, time.time())
8686

8787

8888
def bind(instance_id: str,
8989
binding_id: str,
9090
details: BindDetails,
9191
async_allowed: bool,
92-
**kwargs) -> Binding:
92+
**kwargs):
9393
data = {
9494
"binding_id": binding_id,
9595
"credential": {
9696
},
9797
"last_operation": {
9898
"state": OperationState.IN_PROGRESS,
99-
"description": "%s in progress at %s" % (binding_id, time.time())
99+
"description": "binding %s in progress at %s" % (binding_id, time.time())
100100
}
101101
}
102102
dump_binding_meta(instance_id, data)
@@ -113,24 +113,26 @@ def bind(instance_id: str,
113113
status, templates = command("helm", *args) # output: templates.yaml
114114
if status != 0:
115115
data["last_operation"]["state"] = OperationState.FAILED
116-
data["last_operation"]["description"] = templates
116+
data["last_operation"]["description"] = "binding %s failed: %s" % (instance_id, templates)
117117

118118
credential_template = yaml.load(templates.split('bind.yaml')[1], Loader=yaml.Loader)
119119
success_flag = True
120+
errors = []
120121
for _ in credential_template['credential']:
121122
status, val = get_cred_value(details.context["namespace"], _['ValueFrom'])
122123
if status != 0:
123124
success_flag = False
125+
errors.append(val)
124126
data[_['name']] = val
125127
if success_flag:
126128
data['last_operation'] = {
127129
'state': OperationState.SUCCEEDED,
128-
'description': OperationState.SUCCESSFUL_BOUND,
130+
'description': "binding %s succeeded at %s" % (instance_id, time.time())
129131
}
130132
else:
131133
data['last_operation'] = {
132134
'state': OperationState.FAILED,
133-
'description': OperationState.FAILED,
135+
'description': "binding %s failed: %s" % (instance_id, ','.join(errors))
134136
}
135137
dump_binding_meta(instance_id, data)
136138

0 commit comments

Comments
 (0)