Initial, very incomplete implementation of ogAdmClient in python #7
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "ogadmcli"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
Use story: https://ognproject.evlt.uma.es/redmine/issues/493
Gather data
Obtain local IP address:
ip address show
. In this PR I will use 192.168.1.249.Obtain path to your copy of the
opengnsys
repository. In this PR I will use/home/user/work/opengnsys/opengnsys
.Install requisites
The agent runs
browser
. At this point we're not using any browser, butxeyes
instead. Install xeyes (on debian, it's in the packagex11-apps
.Edit source code a bit
Edit
src/test_modules/server/ogAdmClient/__init__.py
, functioninterfaceAdmin
(line 234) so that the agent knows where to look for the opengnsys shell functions and helpers.Where it says:
Adjust the paths to your environment:
Edit configuration of the agent:
The ogagent configuration at
src/cfg/ogagent.cfg
has two sections:In section
[opengnsys]
, change the IP address in theremote
line:remote=https://192.168.1.249/opengnsys/rest
In section
[ogAdmClient]
change the IP too, and also add__ogAdmClient
to the end:remote=https://192.168.1.249/opengnsys/rest/__ogAdmClient
In section
[ogAdmClient]
changepathinterface
to something like/home/user/opengnsys/opengnsys/admin/Interface
.Go
Run the ogcore server mock (sudo required to listen on port 443):
FLASK_APP=./ogcore-mock.py FLASK_ENV=development FLASK_RUN_CERT=adhoc sudo --preserve-env flask run --host $OGCORE_IP --port 443
In another terminal, run the agent as root. It should load two modules and talk a bit to the ogcore-mock:
Also you should see good old
xeyes
on your screen.Server output
When you run the agent, the output of the ogcore mock server should contain something like the following.
First, the OS agent POSTs to
/started
as usual. This call will probably go away in the future:The oglive agent POSTs to
/InclusionCliente
. The parameter gives details about the disks and partitions that exist where the agent runs. Since the agent is running on your development machine, the info should match your disks and partitions:The oglive agent POSTs to
/AutoexecCliente
:The oglive agent POSTs to
/enviaArchivo
:The oglive agent POSTs to
/ComandosPendientes
:The oglive agent POSTs to
/DisponibilidadComandos
:Agent log output
Basic initialisation:
Modules are found and loaded:
Modules are activated, first the "opengnsys" module:
Now the "Sample1" module (a dummy one that I will probably remove in the future):
And now the "ogAdmClient" module, which does a lot of things.
Get its own IP address:
Sends a POST to
InclusionCliente
:Sends a POST to
AutoexecCliente
:(this "popup" is development stuff)
Sends a POST to
ComandosPendientes
:Sends a POST to
DisponibilidadComandos
:Cleanup
Press ^C to terminate the agent.
Press ^C in the other terminal to terminate the ogserver.
rm -f /tmp/Sautoexec-* /tmp/_autoexec_* /var/run/opengnsys-agent.pid
Initial, very incomplete implementation of ogAdmClient in pythonto WIP: Initial, very incomplete implementation of ogAdmClient in pythonWIP: Initial, very incomplete implementation of ogAdmClient in pythonto Initial, very incomplete implementation of ogAdmClient in pythonArroja error cargando librerías:
Qué raro. ¿No tienes un archivo opengnsys/scriptThread.py?
Hola Natalia,
no, no tengo ese archivo
(Esos cambios son los que he seguido para hacer la PR; evidentemente no llevan commit).
La causa última es que esta rama en mi portátil se bifurcaba desde un punto anterior al mergeo del job manager, y al hacer un clone nuevo esta rama se bifurca desde un punto posterior. La rama del job manager borra el archivo que te faltaba, y de ahí la divergencia. Algún actor debe de haber hecho un rebase de esta rama pero no sé quién, ni cuándo, ni por qué.
El archivo realmente no te falta, porque no debe estar. Me sobraba a mí. He hecho un commit para borrar código inútil (que iba a borrar más tarde anyway). Ya debería funcionar.
ded1e70ef5
to25cfb31725
Ahora he avanzado un poco más, ya levanta, pero da problemas de SSL, ¿algún paso que falte?
En la contra parte, se reciben estos errores
"Wrong version number" ocurre cuando uno de los lados habla HTTP y el otro HTTPS. En este caso parece que el flask está hablando HTTP.
El motivo no nos importa, solo queremos que hablen entre sí, por lo que creo que bastaría con cambiar el
cfg/ogagent.cfg
y ponerremote=http://...
en lugar deremote=https://...
Correcto, con ese cambio, luz.