opsi-script opsdiconfd opsiservicecall description new_line \n
Verfasst: 21 Jul 2022, 23:09
Ich lese mittels
und
unter anderen die Notizen eines Clients aus, ums die Clients dann mittels
und
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:
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?
Code: Alles auswählen
getReturnListFromSection ("opsiservicecall_host_getObjects")
Code: Alles auswählen
set $OpsiNotes$ = jsonAsObjectGetValueByKey($objectstr$, "notes" )
Code: Alles auswählen
opsiservicecall_authenticated /serviceurl "https://101.1.1:4447" /username "opsiadmin" /password "strenggeheim"
Code: Alles auswählen
[opsiservicecall_createClient_save]
"method": "createClient"
"params": [
"$PCName$",
"$OpsiDomain$",
"$OpsiDescr$",
"$OpsiNotes$ \n Created by opsi-move-depot product",
"$IpAddress$"
]
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)
Scheinbar verträgt die ssh Verbindung nicht das \n Zeichen.
Hat wer eine andere Idee, wie ich die Notizen mit migrieren kann?