Commit Graph

219 Commits (c159c76294b6f22386ae619418cec99f4860cc25)
 

Author SHA1 Message Date
Alvaro Neira Ayuso dfc97ffedb Merge ogRest and ogProcess to have only one class 2020-01-19 19:50:44 +01:00
Alvaro Neira Ayuso 77906be87f Include disconnect and send function on client side
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.
2020-01-19 19:50:44 +01:00
Alvaro Neira Ayuso 2997952bc9 Add global variable to set up OpenGnsys path
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.
2020-01-19 19:50:44 +01:00
Alvaro Neira Ayuso 694bc492a2 Add ogRest class to generate API Rest Responses
This class now, allow us to generate API Rest responses. In the future, the idea
is to complete this class with get and post messages if it's needed.
2020-01-19 19:50:44 +01:00
Alvaro Neira Ayuso 7548870a92 Port program to Python 3
Python 2.7 will be deprecated in January of 2020. So, we need to have the program
with a supported api.
2020-01-19 19:50:44 +01:00
Alvaro Neira Ayuso 4ad2759e55 Remove remote from cfg file
This information is older for this version. We don't need to have any information
about the remote.
2020-01-19 19:50:44 +01:00
Alvaro Neira Ayuso cb57e66300 Remove unneeded logs 2020-01-19 19:50:44 +01:00
Alvaro Neira Ayuso dbbc7fa858 Include the reboot support in ogOperation
This new patch allows us to reboot the linux machine using reboot binary or in
OpenGnsys client case, use the specific script.
2020-01-19 19:50:44 +01:00
Alvaro Neira Ayuso 62a8ca4cd8 Include the poweroff support in ogOperation
This new patch allows us to turn off the linux machine using poweroff binary
or in OpenGnsys client case, use the specific script.
2020-01-19 19:50:44 +01:00
Alvaro Neira Ayuso 6479530bf5 Add Probe HTTP Command 2020-01-19 19:50:44 +01:00
Alvaro Neira Ayuso 72e93be46f Remove unneeded logs 2020-01-19 19:50:44 +01:00
Alvaro Neira Ayuso 2d72f00d95 Send bad request when the APIRest operation is not supported
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
2020-01-19 19:50:44 +01:00
Alvaro Neira Ayuso fdf7701a03 Add new process support for reboot message 2020-01-19 19:50:44 +01:00
Alvaro Neira Ayuso 9eabc7f9a8 Execute socket loop on run socket function
Ported code from main function to a client function for clearing the main loop.
2020-01-19 19:50:44 +01:00
Alvaro Neira Ayuso ebd640a9c5 Add ogProcess and ogOperation for linux
Thoses new classes allows us to process and execute commands from server side
sent using HTTP format.
2020-01-19 19:50:44 +01:00
Alvaro Neira Ayuso bfdeae840c Add HTTP parser support
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.
2020-01-19 19:50:44 +01:00
Alvaro Neira Ayuso 076e15bb29 Modify Client state to use enum
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.
2020-01-19 19:50:44 +01:00
Alvaro Neira Ayuso 29fe301ec8 Create new ogClient
This commit init the new ogClient. The new ogClient has support for configuring
and for connecting with the ogAdminServer.
2020-01-19 19:50:44 +01:00
Alvaro Neira Ayuso e3d707cfb3 Initial commit 2020-01-19 19:50:43 +01:00