-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Report fwup version to nerves hub #44
Report fwup version to nerves hub #44
Conversation
Why: * NH needs to know the fwup version to make decisions about delta updates * Resolves Issue nerves-hub#43 This change addresses the need by: * Grab fwup version when creating config * Add fwup version to config params * Add a spec to check that fwup version key is present
@mobileoverlord @fhunleth let me know what you guys think about this. The test is pretty naive and would fail in a testing env without fwup installed so that's a downside but the tradeoff of extracting a module and creating a mock for this didn't really seem worth it. |
IMHO, fwup should be installed everywhere, so I think we should just view that as a given. ;) |
lib/nerves_hub_link/configurator.ex
Outdated
@@ -48,7 +48,9 @@ defmodule NervesHubLink.Configurator do | |||
|> Keyword.put_new(:verify, :verify_peer) | |||
|> Keyword.put_new(:server_name_indication, to_charlist(base.device_api_sni)) | |||
|
|||
%{base | params: Nerves.Runtime.KV.get_all_active(), socket: socket, ssl: ssl} | |||
params = Map.put(Nerves.Runtime.KV.get_all_active(), "nerves_fw_fwup_version", fwup_version()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
params = Map.put(Nerves.Runtime.KV.get_all_active(), "nerves_fw_fwup_version", fwup_version()) | |
params = Map.put(Nerves.Runtime.KV.get_all_active(), "fwup_version", fwup_version()) |
I'm not sure that the nerves_fw_
prefix matters here. My preference would be to drop it, but I don't feel strongly about it.
lib/nerves_hub_link/configurator.ex
Outdated
|
||
defp fwup_version do | ||
{version_string, 0} = System.cmd("fwup", ["--version"]) | ||
version_string |> String.trim() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version_string |> String.trim() | |
String.trim(version_string) |
piping for a short call might be unnecessary
Why: * We don't need to prefix data unnecessarily * We don't need to pipe simple transformations This change addresses the need by: * Remove nerves_fw prefix * Don't pipe
Why: * We want to appropriately capture fwup version from devices * We want to match the way fwup version sent from: * nerves-hub/nerves_hub_link#44 * nerves-hub/nerves_hub_link_http#6 This change addresses the need by: * Update the matching string for fwup_version in the various functions that check conn/channel
Why: * We want to appropriately capture fwup version from devices * We want to match the way fwup version sent from: * nerves-hub/nerves_hub_link#44 * nerves-hub/nerves_hub_link_http#6 This change addresses the need by: * Update the matching string for fwup_version in the various functions that check conn/channel
Why:
This change addresses the need by: