Skip to content

Commit fbcd19a

Browse files
committed
chore(helmbroker): yaml load all templates
1 parent 880aed0 commit fbcd19a

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

rootfs/helmbroker/tasks.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,14 @@ def bind(instance_id: str,
165165
if status != 0:
166166
data["last_operation"]["state"] = OperationState.FAILED.value
167167
data["last_operation"]["description"] = f"binding {instance_id} failed: {templates}"
168-
credential_template = yaml.load(templates.split('bind.yaml')[1], Loader=yaml.Loader)
168+
credential_template = {}
169+
templates = yaml.load_all(templates, Loader=yaml.SafeLoader)
170+
credential_template = next(
171+
(item for item in templates if isinstance(item, dict) and "credential" in item), {}
172+
)
169173
success_flag = True
170174
errors = []
171-
for _ in credential_template['credential']:
175+
for _ in credential_template.get('credential', {}):
172176
if _.get('valueFrom'):
173177
status, val = get_cred_value(details.context["namespace"], _['valueFrom'])
174178
elif _.get('value'):

0 commit comments

Comments
 (0)