Make sure to index all farmware on bootup

This commit is contained in:
Connor Rigby 2017-12-08 14:53:56 -08:00
parent 0ede73849e
commit 601b3e2585
2 changed files with 8 additions and 0 deletions

View file

@ -322,6 +322,7 @@ defmodule Farmbot.BotState do
meta: ser_fw_meta,
name: fw.name,
path: Farmbot.Farmware.Installer.install_path(fw),
config: fw.config,
url: fw.url
}
new_pi = Map.put(state.process_info.farmwares, fw.name, ser_fw)

View file

@ -31,6 +31,13 @@ defmodule Farmbot.Farmware.Installer.Repository.SyncTask do
Installer.sync_repo(repo)
end
all_fws = File.ls!(Installer.install_root_path)
for fw_name <- all_fws do
case Farmbot.Farmware.lookup(fw_name) do
{:ok, %Farmbot.Farmware{} = farmware} -> Farmbot.BotState.register_farmware(farmware)
_ -> :ok
end
end
:ok
end
end