Prevent attempting to firmware update while another in progress#48
Prevent attempting to firmware update while another in progress#48jjcarstens wants to merge 1 commit intomainfrom
Conversation
| end | ||
|
|
||
| defp check_fwup_not_running() do | ||
| if Enum.any?(Port.list(), &("#{Port.info(&1)[:name]}" =~ ~r/fwup/)) do |
There was a problem hiding this comment.
Ok, this is clever enough that I feel compelled to think if there's another way. But, I can definitely see how this works and prevents two instances of fwup running.
Fwiw, the best other idea I have at the moment would be for fwup to create a lock file based on the output when it runs.
There was a problem hiding this comment.
Ya, I had the same thought, researched a bit, then decided to just start with the easiest
We could also just wrap this port process in a singleton genserver or something as well which would control fwup processes. I'm open to whatever.
It seems like checking for a running fwup port process is going to be just as effective as checking for a file on disk. The file seems like more risk to me in case the fwup process crashes without cleaning it up and thinks look to still be running (but I might guess you know the C way to get around that 😂)
|
@jjcarstens @fhunleth is this issue and PR still relevant? |
Attempting to run multiple firmware updates at the same time could potentially be bad. So this adds a quick check if the fwup port is running and returns a more useful error to the SSH connection if it is
Fixes #36