Fetch a new token if os update gets a 404

pull/437/head
connor rigby 2018-01-30 13:00:49 -08:00
parent 8d938a0754
commit 5552c68fa3
1 changed files with 4 additions and 1 deletions

View File

@ -82,7 +82,6 @@ defmodule Farmbot.System.Updates do
end
if should_apply_update(@env, prerelease, needs_update) do
Logger.busy 1, "Downloading FarmbotOS over the air update"
IO.puts cl
@ -103,6 +102,10 @@ defmodule Farmbot.System.Updates do
{:error, reason} ->
Logger.error 1, "Failed to fetch update data: #{inspect reason}"
{:ok, %{status_code: 400}} ->
Logger.info 2, "Had out of date token. Try that again."
Farmbot.Bootstrap.AuthTask.force_refresh()
{:ok, %{body: body, status_code: code}} ->
reason = case Poison.decode(body) do
{:ok, res} -> res