diff --git a/lib/towerops/billing.ex b/lib/towerops/billing.ex index 9aeff595..6e203565 100644 --- a/lib/towerops/billing.ex +++ b/lib/towerops/billing.ex @@ -39,6 +39,7 @@ defmodule Towerops.Billing do case Settings.get_setting("default_price_per_device") do nil -> @default_price_per_device %Decimal{} = decimal -> decimal + string when is_binary(string) -> Decimal.new(string) end end diff --git a/lib/towerops/snmp/discovery.ex b/lib/towerops/snmp/discovery.ex index fb262b09..9aca0c72 100644 --- a/lib/towerops/snmp/discovery.ex +++ b/lib/towerops/snmp/discovery.ex @@ -33,6 +33,7 @@ defmodule Towerops.Snmp.Discovery do alias Towerops.Snmp.Sensor alias Towerops.Snmp.Storage alias Towerops.Snmp.Vlan + alias Towerops.Topology alias Towerops.Workers.DiscoveryWorker require Logger @@ -276,6 +277,10 @@ defmodule Towerops.Snmp.Discovery do {:ok, check_counts} = Towerops.Snmp.create_checks_from_discovery(device, discovered_device) log_check_creation_results(device.id, check_counts) + # Infer and update device role from SNMP data + Logger.info("Inferring device role...", device_id: device.id) + _ = Topology.maybe_update_device_role(device) + _ = Phoenix.PubSub.broadcast( Towerops.PubSub,