mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-30 07:16:04 +08:00
Do not rely on to_existing_atom as atoms may not have been loaded
This commit is contained in:
parent
5f7f2ecffa
commit
629cc3f5a3
1 changed files with 5 additions and 2 deletions
|
|
@ -294,7 +294,7 @@ defmodule Livebook.Hubs.TeamClient do
|
|||
%Teams.DeploymentGroup{
|
||||
id: deployment_group.id,
|
||||
name: deployment_group.name,
|
||||
mode: String.to_existing_atom(deployment_group.mode),
|
||||
mode: atomize(deployment_group.mode),
|
||||
hub_id: state.hub.id,
|
||||
secrets: secrets,
|
||||
agent_keys: agent_keys,
|
||||
|
|
@ -528,8 +528,11 @@ defmodule Livebook.Hubs.TeamClient do
|
|||
defp find_deployment_group(nil, _), do: nil
|
||||
defp find_deployment_group(id, groups), do: Enum.find(groups, &(&1.id == id))
|
||||
|
||||
# We cannot use to_existing_atom because the atoms
|
||||
# may not have been loaded. Luckily, we can trust
|
||||
# on Livebook Teams as a source.
|
||||
defp atomize(value) when value in [nil, ""], do: nil
|
||||
defp atomize(value), do: String.to_existing_atom(value)
|
||||
defp atomize(value), do: String.to_atom(value)
|
||||
|
||||
defp nullify(""), do: nil
|
||||
defp nullify(value), do: value
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue