OPSI ServiceCall wirft HTTPSender Error

magicalUnicorn
Beiträge: 121
Registriert: 07 Mär 2019, 14:46

OPSI ServiceCall wirft HTTPSender Error

Beitrag von magicalUnicorn »

Moin Zusammen,

ich probiere mich aktuell (grob an folgenden Thread angelehnt viewtopic.php?t=11243) daran, ein Paket zu schreiben um Clients von einem Configserver auf einen anderen umzuziehen.

Grundsätzlich hab ich bereits alle Befehle auf dem Ziel-Configserver getestet. Jetzt muss ich dir nur als OpsiServiceCall im OPSI-Skript verpacken. Aktuell sieht das wie folgt aus:

Code: Alles auswählen

opsiservicecall_test /serviceurl "*FQDN*" /user "username" /password "password"

[opsiservicecall_test]
"method": "host_createOpsiClient"
"params": [
	"%FQDN%"
	]
Als User und Passwort nutze ich zum testen aktuell den selben User, den ich auch zum Login im Configed nutze. Den Tausche ich später natürlich dann durch einen dafür dedizierten User aus. Leider schlägt das ganze dann immer Fehl. Das Log wirft dazu folgendes aus:

Code: Alles auswählen

[6] [2023-09-05 15:02:59.722] []      "method": "host_createOpsiClient"
[6] [2023-09-05 15:03:15.822] []   Lib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-winst\ssleay32.dll
[7] [2023-09-05 15:03:15.836] []   SLLVersion : TLSv1.2
[7] [2023-09-05 15:03:15.843] []   Loaded: ssl_openssl
[7] [2023-09-05 15:03:15.851] []   HTTPSender.Sock.SSL.LibVersion: OpenSSL 1.0.2u  20 Dec 2019
[8] [2023-09-05 15:03:15.858] []   HTTPSender.Sock.GetLocalSinIP :
[6] [2023-09-05 15:03:15.867] []   SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-winst\ssleay32.dll
[3] [2023-09-05 15:03:17.993] []   HTTPSender Post failed
[3] [2023-09-05 15:03:18.001] []   HTTPSender result: 500 msg:
[8] [2023-09-05 15:03:18.009] []   Exception in retrieveJSONObject0: POST /rpc HTTP/1.1
[6] [2023-09-05 15:03:18.017] []   Retry with communicationmode: 1
[6] [2023-09-05 15:03:18.025] []   SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-winst\ssleay32.dll
[3] [2023-09-05 15:03:20.179] []   HTTPSender Post failed
[3] [2023-09-05 15:03:20.189] []   HTTPSender result: 500 msg:
[8] [2023-09-05 15:03:20.201] []   Exception in retrieveJSONObject0: POST /rpc HTTP/1.1
[6] [2023-09-05 15:03:20.210] []   Retry with communicationmode: 2
[6] [2023-09-05 15:03:20.219] []   SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-winst\ssleay32.dll
[3] [2023-09-05 15:03:22.342] []   HTTPSender Post failed
[3] [2023-09-05 15:03:22.346] []   HTTPSender result: 500 msg:
[8] [2023-09-05 15:03:22.349] []   Exception in retrieveJSONObject0: POST /rpc HTTP/1.1
[5] [2023-09-05 15:03:22.352] []   opsi Server Version :
[6] [2023-09-05 15:03:22.496] []   Lib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-winst\ssleay32.dll
[7] [2023-09-05 15:03:22.499] []   SLLVersion : TLSv1.2
[7] [2023-09-05 15:03:22.502] []   Loaded: ssl_openssl
[7] [2023-09-05 15:03:22.506] []   HTTPSender.Sock.SSL.LibVersion: OpenSSL 1.0.2u  20 Dec 2019
[8] [2023-09-05 15:03:22.510] []   HTTPSender.Sock.GetLocalSinIP :
[6] [2023-09-05 15:03:22.513] []   SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-winst\ssleay32.dll
[3] [2023-09-05 15:03:24.658] []   HTTPSender Post failed
[3] [2023-09-05 15:03:24.663] []   HTTPSender result: 500 msg:
[8] [2023-09-05 15:03:24.667] []   Exception in retrieveJSONObject0: POST /rpc HTTP/1.1
[6] [2023-09-05 15:03:24.669] []   Retry with communicationmode: 1
[6] [2023-09-05 15:03:24.672] []   SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-winst\ssleay32.dll
[3] [2023-09-05 15:03:26.802] []   HTTPSender Post failed
[3] [2023-09-05 15:03:26.806] []   HTTPSender result: 500 msg:
[8] [2023-09-05 15:03:26.809] []   Exception in retrieveJSONObject0: POST /rpc HTTP/1.1
[6] [2023-09-05 15:03:26.812] []   Retry with communicationmode: 2
[6] [2023-09-05 15:03:26.815] []   SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-winst\ssleay32.dll
[3] [2023-09-05 15:03:28.943] []   HTTPSender Post failed
[3] [2023-09-05 15:03:28.948] []   HTTPSender result: 500 msg:
[8] [2023-09-05 15:03:28.958] []   Exception in retrieveJSONObject0: POST /rpc HTTP/1.1
[3] [2023-09-05 15:03:35.983] []   Error: Cancelled by user
[3] [2023-09-05 15:03:36.006] []   Error: no connection to service
Hat da jemand eine zündende Idee? Oder stößt mich mit dem Gesicht auf eine viel einfacherere Methode zur Migration? :D
Benutzeravatar
j.schneider
uib-Team
Beiträge: 1819
Registriert: 29 Mai 2008, 15:14

Re: OPSI ServiceCall wirft HTTPSender Error

Beitrag von j.schneider »

Hallo,

als erstes fällt mir auf, dass hier wohl eine sehr alte opsi-script-Version mit OpenSSL 1.0.2u verwendet wird.
Da würde ich erst mal auf eine aktuelle Version wechseln.

Grüße
Jan Schneider
magicalUnicorn
Beiträge: 121
Registriert: 07 Mär 2019, 14:46

Re: OPSI ServiceCall wirft HTTPSender Error

Beitrag von magicalUnicorn »

Hi Jan,

auf dem Client, den ich zum testen nutze, sind opsi-script 4.12.9.1-3 und der opsi-client-agent 4.2.0.61-1 installiert.

Für OPSI-Script gibt es mittlerweile ja 4.12.10.0-3 und für den Client die 4.2.0.64-1. Ich kann da gerne mal beides aktualisieren, aber so alt sind die beiden Pakete jetzt doch nicht :D
Benutzeravatar
j.schneider
uib-Team
Beiträge: 1819
Registriert: 29 Mai 2008, 15:14

Re: OPSI ServiceCall wirft HTTPSender Error

Beitrag von j.schneider »

Welche opsi-script Version steht denn ganz am Anfang des instlog?
Das scheint mir noch ein opsi-winst und kein opsi-script zu sein.
magicalUnicorn
Beiträge: 121
Registriert: 07 Mär 2019, 14:46

Re: OPSI ServiceCall wirft HTTPSender Error

Beitrag von magicalUnicorn »

"opsi-script 4.12.4.31 started at >>"

opsi-winst ist auf dem Rechner tatsächlich auch noch drauf. Ich gehe mal davon aus, dass opsi-script das alte opsi-winst ersetzt?

Die Version oben passt aber lustigerweise weder zur installierten winst, oder script version
Benutzeravatar
j.schneider
uib-Team
Beiträge: 1819
Registriert: 29 Mai 2008, 15:14

Re: OPSI ServiceCall wirft HTTPSender Error

Beitrag von j.schneider »

Ja, genau, opsi-winst wurde vor einiger Zeit umbenannt in opsi-script.
Wichtig ist, dass auf den opsi-Depotservern das Paket opsi-script installiert ist.
magicalUnicorn
Beiträge: 121
Registriert: 07 Mär 2019, 14:46

Re: OPSI ServiceCall wirft HTTPSender Error

Beitrag von magicalUnicorn »

Auf den Depotservern sind beide Pakete installiert. Den neuen hab ich erst vor einigen Wochen aufgesetzt, soll das dann trotzdem so sein?

Und warum nutzt der Client dann eine gänzlich andere Version, als die die eigentlich installiert sind?
Benutzeravatar
wolfbardo
uib-Team
Beiträge: 1354
Registriert: 01 Jul 2008, 12:10

Re: OPSI ServiceCall wirft HTTPSender Error

Beitrag von wolfbardo »

magicalUnicorn hat geschrieben: 07 Sep 2023, 08:29 Auf den Depotservern sind beide Pakete installiert. Den neuen hab ich erst vor einigen Wochen aufgesetzt, soll das dann trotzdem so sein?

Und warum nutzt der Client dann eine gänzlich andere Version, als die die eigentlich installiert sind?
Welche opsi-script Version steht denn am Anfang in der opsiscript.log / instlog?

Wenn da eine alte drin steht, so schlägt evtl die automatische Aktualisierung durch den opsiclientd fehl?!
Dann steht ggfs was in den opsiclientd.Logs des Clients.

Gruss
Bardo Wolf


OPSICONF 2024
https://opsi.org/en/opsiconf/

Basisworkshop Mainz :

17. - 20. 06. 2024


opsi support - uib gmbh
For productive opsi installations we recommend maintainance + support contracts which are the base of opsi development.

http://www.uib.de
magicalUnicorn
Beiträge: 121
Registriert: 07 Mär 2019, 14:46

Re: OPSI ServiceCall wirft HTTPSender Error

Beitrag von magicalUnicorn »

Moin,

laut log: [6] [2023-09-07 11:18:51.319] [] opsi-script has version 4.12.4.31

Im opsiclientd.log finde ich dann aber z.B.

[5] [2023-09-07 08:52:01.627] [event processing timer ] Action processor name 'opsi-script', version '4.12.9.1' (EventProcessing.py:415)

Der ServiceCall an sich funktioniert jetzt auch, nachdem ich in der serviceurl den Port ergänz habe :mrgreen:
Allerdings scheiter ich noch daran, Variablen im ServiceCalle einzusetzen. Der Servicecall sieht aktuell wie folgt aus:

Code: Alles auswählen

[opsiservicecall_test]
"method": "host_createOpsiClient"
"params": [
	"%FQDN"
	]
Wenn ich da einfach einen festen String reinpacke, klappt. Die Doku macht mich leider auch nicht wirklich schlauer :/

Code: Alles auswählen

 Error: retrieveJSONObject --- opsi service problem ----> {"message":"Bad object id: '%fqdn%'","details":"Traceback (most recent call last):\n  File \"opsiconfd\/application\/jsonrpc.py\", line 532, in process_rpcs\n  File \"opsiconfd\/application\/jsonrpc.py\", line 509, in process_rpc\n  File \"starlette\/concurrency.py\", line 41, in run_in_threadpool\n  File \"anyio\/to_thread.py\", line 33, in run_sync\n  File \"anyio\/_backends\/_asyncio.py\", line 877, in run_sync_in_worker_thread\n  File \"anyio\/_backends\/_asyncio.py\", line 807, in run\n  File \"opsiconfd\/application\/jsonrpc.py\", line 439, in execute_rpc\n  File \"<string>\", line 1, in host_createOpsiClient\n  File \"OPSI\/Backend\/Base\/Extended.py\", line 122, in _executeMethod\n  File \"<string>\", line 1, in host_createOpsiClient\n  File \"OPSI\/Backend\/Base\/Extended.py\", line 122, in _executeMethod\n  File \"<string>\", line 1, in host_createOpsiClient\n  File \"OPSI\/Backend\/Manager\/AccessControl.py\", line 443, in _executeMethodProtected\n  File \"<string>\", line 1, in host_createOpsiClient\n  File \"OPSI\/Backend\/Base\/Extended.py\", line 122, in _executeMethod\n  File \"<string>\", line 1, in host_createOpsiClient\n  File \"OPSI\/Backend\/Base\/Extended.py\", line 122, in _executeMethod\n  File \"<string>\", line 1, in host_createOpsiClient\n  File \"OPSI\/Backend\/Base\/Extended.py\", line 122, in _executeMethod\n  File \"OPSI\/Backend\/Base\/Extended.py\", line 659, in host_createOpsiClient\n  File \"opsicommon\/objects.py\", line 704, in fromHash\n  File \"opsicommon\/objects.py\", line 621, in fromHash\n  File \"opsicommon\/objects.py\", line 547, in fromHash\n  File \"opsicommon\/objects.py\", line 431, in fromHash\n  File \"opsicommon\/objects.py\", line 649, in __init__\n  File \"opsicommon\/objects.py\", line 571, in __init__\n  File \"opsicommon\/objects.py\", line 509, in __init__\n  File \"opsicommon\/objects.py\", line 590, in setId\n  File \"opsicommon\/types.py\", line 319, in forceFqdn\n  File \"opsicommon\/types.py\", line 611, in forceObjectId\nValueError: Bad object id: '%fqdn%'\n","class":"ValueError"}
[3] [2023-09-07 11:27:08.599] []   Received (first 512): {"id":1,"result":null,"error":{"message":"Bad object id: '%fqdn%'","class":"ValueError","details":"Traceback (most recent call last):\n  File \"opsiconfd/application/jsonrpc.py\", line 532, in process_rpcs\n  File \"opsiconfd/application/jsonrpc.py\", line 509, in process_rpc\n  File \"starlette/concurrency.py\", line 41, in run_in_threadpool\n  File \"anyio/to_thread.py\", line 33, in run_sync\n  File \"anyio/_backends/_asyncio.py\", line 877, in run_sync_in_worker_thread\n  File \"anyio/_backends/_asyncio
[3] [2023-09-07 11:27:08.608] []   Error: -> {"message":"Bad object id: '%fqdn%'","details":"Traceback (most recent call last):\n  File \"opsiconfd\/application\/jsonrpc.py\", line 532, in process_rpcs\n  File \"opsiconfd\/application\/jsonrpc.py\", line 509, in process_rpc\n  File \"starlette\/concurrency.py\", line 41, in run_in_threadpool\n  File \"anyio\/to_thread.py\", line 33, in run_sync\n  File \"anyio\/_backends\/_asyncio.py\", line 877, in run_sync_in_worker_thread\n  File \"anyio\/_backends\/_asyncio.py\", line 807, in run\n  File \"opsiconfd\/application\/jsonrpc.py\", line 439, in execute_rpc\n  File \"<string>\", line 1, in host_createOpsiClient\n  File \"OPSI\/Backend\/Base\/Extended.py\", line 122, in _executeMethod\n  File \"<string>\", line 1, in host_createOpsiClient\n  File \"OPSI\/Backend\/Base\/Extended.py\", line 122, in _executeMethod\n  File \"<string>\", line 1, in host_createOpsiClient\n  File \"OPSI\/Backend\/Manager\/AccessControl.py\", line 443, in _executeMethodProtected\n  File \"<string>\", line 1, in host_createOpsiClient\n  File \"OPSI\/Backend\/Base\/Extended.py\", line 122, in _executeMethod\n  File \"<string>\", line 1, in host_createOpsiClient\n  File \"OPSI\/Backend\/Base\/Extended.py\", line 122, in _executeMethod\n  File \"<string>\", line 1, in host_createOpsiClient\n  File \"OPSI\/Backend\/Base\/Extended.py\", line 122, in _executeMethod\n  File \"OPSI\/Backend\/Base\/Extended.py\", line 659, in host_createOpsiClient\n  File \"opsicommon\/objects.py\", line 704, in fromHash\n  File \"opsicommon\/objects.py\", line 621, in fromHash\n  File \"opsicommon\/objects.py\", line 547, in fromHash\n  File \"opsicommon\/objects.py\", line 431, in fromHash\n  File \"opsicommon\/objects.py\", line 649, in __init__\n  File \"opsicommon\/objects.py\", line 571, in __init__\n  File \"opsicommon\/objects.py\", line 509, in __init__\n  File \"opsicommon\/objects.py\", line 590, in setId\n  File \"opsicommon\/types.py\", line 319, in forceFqdn\n  File \"opsicommon\/types.py\", line 611, in forceObjectId\nValueError: Bad object id: '%fqdn%'\n","class":"ValueError"}
Benutzeravatar
j.schneider
uib-Team
Beiträge: 1819
Registriert: 29 Mai 2008, 15:14

Re: OPSI ServiceCall wirft HTTPSender Error

Beitrag von j.schneider »

Bei "%FQDN" fehlt ein "%".
An dieser Stelle besser "%HostID%" verwenden.

https://docs.opsi.org/opsi-docs-de/4.2/ ... st-service
Antworten