VM dashboard - do not crash on missing configuration
This commit is contained in:
parent
82c12bd234
commit
11270fc7b1
1 changed files with 3 additions and 3 deletions
|
@ -11,12 +11,12 @@ defmodule Meta.OpenNebula do
|
||||||
# OpenNebula daemon.
|
# OpenNebula daemon.
|
||||||
@endpoint "/RPC2"
|
@endpoint "/RPC2"
|
||||||
|
|
||||||
defp get_opennebula_config(key) do
|
defp get_opennebula_config(key, default \\ nil) do
|
||||||
Application.get_env(:meta, :opennebula, []) |> Keyword.get(key)
|
Application.get_env(:meta, :opennebula, []) |> Keyword.get(key, default)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_locations() do
|
def get_locations() do
|
||||||
get_opennebula_config(:locations)
|
get_opennebula_config(:locations, [])
|
||||||
|> Enum.map(fn m -> Map.get(m, :name) end)
|
|> Enum.map(fn m -> Map.get(m, :name) end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue