This patch adds support for handling the error when the command is wrong formed.
Now, if we send a shell/run command and the shell command is incomplete,
the program crashes.
This patch changes the command process blocking the execution until is processing.
Moreover, the response will be OK (200) instead of IN_PROGRESS (202).
Right now, all the thread functions are declared inside the processor function.
Those functions were created for execute specific commands in the machine
(poweroff, reboot, etc). Creating this new class we are cleaning up the code.
Opengnsys needs a support to execute commands on the machine. This patch adds
the support for executing two new commands "shell/run" and "shell/output". The
first one, give us the support for executing a command in the machine and keep
save in a queue the output. The second one, give us the support for sending the
output from the command executed.
To disconnect the socket or send a message we use in different parts of the code
the attribute socket which is declared inside of the client. This way will
create us important problem in the future if we want to change the behavior in
our client sockets. This patch adds two new methods inside the client and we
can use them in other classes giving us the easy way to send messages and
disconnect the client.
This variable allow us to modify the opengnsys path without modify several parts
of the code. This change reduces the probability to add any bug forgetting to
change any line.
Our program sends always the HTTP message:
HTTP/1.0 200 OK
but if the operation sent is not supported, we are sending the same correct
message. This patch add the support to check if the message is supported.
If the message is not supported, we are going to send:
HTTP/1.0 400 Bad request\r\n\r\n
Otherwise, in operations supported:
HTTP/1.0 200 OK
The new OpenGnsys support to communicate server and client side will be
HTTP. This new class allows us the support for parsing all the message received
from the server in HTTP format.
During our connections, we are using states to control the Client Socket. We
defined using global variables. In case that we modify this global variable,
we need to change it in serveral parts of the code.
Using enums and declaring a new class, we can redefine the values or create new
states without changing the same code in differents python files.