Skip to content

Commit

Permalink
Refactor UserCredentialsConfigurator to handle multiple results
Browse files Browse the repository at this point in the history
  • Loading branch information
arash77 committed Jan 10, 2025
1 parent f3c8612 commit 7352004
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/galaxy/tools/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,17 @@ def set_environment_variables(self, source_type: str, source_id: str, credential
)
sa_session = self.app.model.context
if sa_session:
result = sa_session.execute(stmt).one()
result = sa_session.execute(stmt).all()
else:
raise ValueError("Session is not available.")
_, group, var = result
current_group = group.name
current_group = result[0][1].name
user_vault = UserVaultWrapper(self.app.vault, self.job.user)
for secret in credential.secrets:
vault_ref = f"{source_type}|{source_id}|{reference}|{current_group}|{secret.name}"
vault_value = user_vault.read_secret(vault_ref) or ""
self.environment_variables.append({"name": secret.inject_as_env, "value": vault_value})
for variable in credential.variables:
var = next((x[2] for x in result if x[2].name == variable.name), None)
variable_value = var.value if var else ""
self.environment_variables.append({"name": variable.inject_as_env, "value": variable_value})

Expand Down

0 comments on commit 7352004

Please sign in to comment.