From 5552c68fa3d27305ebb3636e0d272e0564b9080e Mon Sep 17 00:00:00 2001 From: connor rigby Date: Tue, 30 Jan 2018 13:00:49 -0800 Subject: [PATCH] Fetch a new token if os update gets a 404 --- lib/farmbot/system/updates/updates.ex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/farmbot/system/updates/updates.ex b/lib/farmbot/system/updates/updates.ex index 56ecaff3..04b8bb64 100644 --- a/lib/farmbot/system/updates/updates.ex +++ b/lib/farmbot/system/updates/updates.ex @@ -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