We observed that with the new ogClient the ogLive did not show the
realtime log menu*.
This commit changes the ogClient to launch the browser and show the
realtime log menu when some commands are executed.
* The realtime log menu is a menu that shows current status and info
about the command that the ogLive is executing.
We have observed that the ogLive browser did not show the changes when
an image restoration o script execution was called. The problem was that
the HTML menu was not updated/regenerated in these cases.
This commit adds the call to the HTML regeneration function to image
restore and script execution commands. This way, when the browser is
restarted it loads the updated HTML menu.
We have observed that the browser did not show changes. This happens
because the ogClient opens the browser at the beginning and forget
about it. To show correctly the changes ogClient had to restart the
browser every time the menu html changes.
This commit changes the behaviour to restart the browser when the menu
html has changed.
Testing the ogClient I found that if a value of the json match a key the
ogClient has an exception. For example:
body = "... shell/run {"run": "fdisk -l"} ..."
CURRENT
Enters in
if "disk" in body:...
if "run" in body:...
EXPECTED
Enters in
if "run" in body:...
This commit changes the behaviour to search for the keys in the
dictionary returned by json.loads() instead of searching in the raw
string. This way the ogClient looks for the keys without searching in
the values.
With our client disconnection, we hid that the ogClient process will be
closed too. This new way only close the subprocess keeping the ogClient
still working.
This patch allows us to control the thread using a state machine. This state
machine controls if the client is busy or not. This new way to control the
threads give us more control for avoiding race condition problems.
From pep-0008: Method Names and Instance Variables
Use the function naming rules: lowercase with words separated by underscores as
necessary to improve readability.
This is applied to /software and /hardware file reads.
We should use 'with' instead of opening and closing a file since this prevents
that files stay open after an exception is raised.