opsi-script opsdiconfd opsiservicecall description new_line \n

Antworten
rfrankow
Beiträge: 140
Registriert: 03 Jul 2008, 15:06

opsi-script opsdiconfd opsiservicecall description new_line \n

Beitrag von rfrankow »

Ich lese mittels

Code: Alles auswählen

getReturnListFromSection ("opsiservicecall_host_getObjects") 
und

Code: Alles auswählen

set $OpsiNotes$ = jsonAsObjectGetValueByKey($objectstr$, "notes" ) 
unter anderen die Notizen eines Clients aus, ums die Clients dann mittels

Code: Alles auswählen

opsiservicecall_authenticated  /serviceurl "https://101.1.1:4447" /username "opsiadmin" /password "strenggeheim" 
und

Code: Alles auswählen

[opsiservicecall_createClient_save]
"method": "createClient"
"params": [
	"$PCName$", 
	"$OpsiDomain$",
	"$OpsiDescr$",
	"$OpsiNotes$ \n Created by opsi-move-depot product",
	"$IpAddress$"
]
auf einen neuen Server anzulegen.

Solange kein Zeilenumbruch (\n) in $OpsiNotes$ enthalten ist, funktioniert alles.
Wenn jedoch ein Zeilenumbruch (\n) bei ist, bricht das Script ab:

Code: Alles auswählen

(262)     [6] [2022-07-21 23:05:50.143] [opsi-move-depot]      "method": "createClient"
(263)     [6] [2022-07-21 23:05:50.143] [opsi-move-depot]   SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\ssleay32.dll
(264)     [8] [2022-07-21 23:05:50.149] [opsi-move-depot]   Exception in retrieveJSONObject0: HTTP/1.1 400 Bad Request
(265)     [6] [2022-07-21 23:05:50.149] [opsi-move-depot]   We had a 400 (bad request) result - so we retry with other parameters / communication compatibility modes
(266)     [6] [2022-07-21 23:05:50.149] [opsi-move-depot]   Retry with communicationmode: 1
(267)     [6] [2022-07-21 23:05:50.150] [opsi-move-depot]   SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\ssleay32.dll
(268)     [8] [2022-07-21 23:05:50.154] [opsi-move-depot]   Exception in retrieveJSONObject0: HTTP/1.1 400 Bad Request
(269)     [6] [2022-07-21 23:05:50.154] [opsi-move-depot]   We had a 400 (bad request) result - so we retry with other parameters / communication compatibility modes
(270)     [6] [2022-07-21 23:05:50.155] [opsi-move-depot]   Retry with communicationmode: 2
(271)     [6] [2022-07-21 23:05:50.155] [opsi-move-depot]   SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\ssleay32.dll
(272)     [8] [2022-07-21 23:05:50.159] [opsi-move-depot]   Exception in retrieveJSONObject0: HTTP/1.1 400 Bad Request
(273)     [6] [2022-07-21 23:05:50.159] [opsi-move-depot]   We had a 400 (bad request) result - so we retry with other parameters / communication compatibility modes
(274)     [3] [2022-07-21 23:05:50.160] [opsi-move-depot]   Error:
(275)     [8] [2022-07-21 23:05:50.160] [opsi-move-depot]     retrieving strings from getReturnListFromSection
(276)     [8] [2022-07-21 23:05:50.160] [opsi-move-depot]         (string   0)
(277)     [8] [2022-07-21 23:05:50.160] [opsi-move-depot]         
(278)     [7] [2022-07-21 23:05:50.160] [opsi-move-depot]   The value of the variable "$INST_ResultList$" is now:
(279)     [7] [2022-07-21 23:05:50.160] [opsi-move-depot]   (string   0)
Der Versuch des ersetzen des \n mitells StringReplace() funktioniert nicht.
Scheinbar verträgt die ssh Verbindung nicht das \n Zeichen.

Hat wer eine andere Idee, wie ich die Notizen mit migrieren kann?
Benutzeravatar
j.werner
uib-Team
Beiträge: 64
Registriert: 08 Okt 2019, 13:32

Re: opsi-script opsdiconfd opsiservicecall description new_line \n

Beitrag von j.werner »

Hallo,

welche opsi-script/opsiconfd Version verwenden Sie?

Bitte mal mit dem aktuellen opsi-script probieren.

Mit freundlichen Grüßen
Jan
rfrankow
Beiträge: 140
Registriert: 03 Jul 2008, 15:06

Re: opsi-script opsdiconfd opsiservicecall description new_line \n

Beitrag von rfrankow »

Vielen Dank dem Support.
Mit opsi-script 4.12.5.6 geht's problemlos.
Antworten