Fetch a new token if os update gets a 404
This commit is contained in:
parent
8d938a0754
commit
5552c68fa3
|
@ -82,7 +82,6 @@ defmodule Farmbot.System.Updates do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if should_apply_update(@env, prerelease, needs_update) do
|
if should_apply_update(@env, prerelease, needs_update) do
|
||||||
Logger.busy 1, "Downloading FarmbotOS over the air update"
|
Logger.busy 1, "Downloading FarmbotOS over the air update"
|
||||||
IO.puts cl
|
IO.puts cl
|
||||||
|
@ -103,6 +102,10 @@ defmodule Farmbot.System.Updates do
|
||||||
{:error, reason} ->
|
{:error, reason} ->
|
||||||
Logger.error 1, "Failed to fetch update data: #{inspect 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}} ->
|
{:ok, %{body: body, status_code: code}} ->
|
||||||
reason = case Poison.decode(body) do
|
reason = case Poison.decode(body) do
|
||||||
{:ok, res} -> res
|
{:ok, res} -> res
|
||||||
|
|
Loading…
Reference in a new issue