Funktionsparameter StringList akzeptiert keine Übergabe von anderen Funktionen

Antworten
larsg
Beiträge: 283
Registriert: 16 Dez 2014, 18:06

Funktionsparameter StringList akzeptiert keine Übergabe von anderen Funktionen

Beitrag von larsg »

Wie oben beschrieben.


Beispiel:

Code: Alles auswählen

[Actions]
DefFunc Test(Val $Test$:StringList):Void
	Comment TakeString(0,$Test$)
EndFunc

SetLogLevel=9
Test(CreateStringList("test"))
Erzeugt:

Code: Alles auswählen

[1] [Jun 19 11:07:20:302] --
[1] [Jun 19 11:07:20:303] --
[1] [Jun 19 11:07:20:304] c:\opsi.org\log\opsi-script-part-Mr57Wl49.log
[1] [Jun 19 11:07:20:306] opsi-script 4.12.0.20 started at 19.06.2018 11:07:18
[1] [Jun 19 11:07:20:307] opsi-script log file with encoding utf8
[3] [Jun 19 11:07:20:309] readconfig failed: Perhaps got defaults 
[6] [Jun 19 11:07:20:311] Depot path from readconfig:  p:\
[6] [Jun 19 11:07:20:312] Restoring depot path from backup
[1] [Jun 19 11:07:20:313] Prog: force_min_loglevel: 4
[1] [Jun 19 11:07:20:314] Prog: default_loglevel: 7
[1] [Jun 19 11:07:20:315] Prog: debug_prog: False
[1] [Jun 19 11:07:20:317] Prog: debug_lib: False
[1] [Jun 19 11:07:20:319] Prog: ScriptErrorMessages: False
[1] [Jun 19 11:07:20:320] Prog: AutoActivityDisplay: False
[6] [Jun 19 11:07:20:320] Using new Depot path:  
[1] [Jun 19 11:07:20:324] 
[1] [Jun 19 11:07:20:326] ============ Version 4.12.0.20 script "C:\Users\user\test.opsiscript"
[1] [Jun 19 11:07:20:328]              used script encoding: cp1252
[1] [Jun 19 11:07:20:330]              used system encoding: cp1252
[1] [Jun 19 11:07:20:332]              start: 2018-06-19  11:07:20 
[1] [Jun 19 11:07:20:334]              on client named    "client"
[1] [Jun 19 11:07:20:338]              loggedin user    "user"
[1] [Jun 19 11:07:20:340]              opsi-script running as    "user"
[4] [Jun 19 11:07:20:342]              opsi-script not running with admin privileges
[1] [Jun 19 11:07:20:344]              opsi-script running in standard script mode
[1] [Jun 19 11:07:20:345] executing: "C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-winst\winst32.exe"
[1] [Jun 19 11:07:20:347] system infos:
[1] [Jun 19 11:07:20:364] 94-65-9C-3D-AF-21  -  PC hardware address
[1] [Jun 19 11:07:20:367] client.fqdn.de  -  IP name 
[1] [Jun 19 11:07:20:369] 192.168.56.1  -  IP address
[1] [Jun 19 11:07:20:371] DEU  -  System default locale 
[7] [Jun 19 11:07:20:373] Registry started without redirection (64 Bit)
[1] [Jun 19 11:07:20:375] MS Windows 10.0 64 Bit, Edition: Windows Enterprise 2015 LTSB
[1] [Jun 19 11:07:20:377] 
[7] [Jun 19 11:07:20:381] Registry started readonly
[7] [Jun 19 11:07:20:383] Registry started without redirection (64 Bit)
[6] [Jun 19 11:07:20:388] Registry key [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion]  opened
[6] [Jun 19 11:07:20:391] Key closed
[6] [Jun 19 11:07:20:437] Added defined function: test to the known functions
[6] [Jun 19 11:07:20:439] LogLevel was 7
[6] [Jun 19 11:07:20:440] LogLevel set to 9
[9] [Jun 19 11:07:20:442] Parsingprogress: r: Test(CreateStringList("test")) exp: 
[9] [Jun 19 11:07:20:444] Parsingprogress: r: (CreateStringList("test")) exp: Test
[8] [Jun 19 11:07:20:446] We are coming from function with index: -1 (-1 = base)
[8] [Jun 19 11:07:20:448] We enter the defined function: test with 1 lines. inDefFuncLevel: 1
[8] [Jun 19 11:07:20:449] Paramnr: 0 is : CreateStringList("test"
[2] [Jun 19 11:07:20:453] Syntax Error: Parameter parsing failed:  Expressionstr not terminated Error: StringList expression expected, but: CreateStringList("test" gives no stringlist
[8] [Jun 19 11:07:20:455] We leave the defined function: test ; inDefFuncLevel: 0
[3] [Jun 19 11:07:20:457] Call of defined function: Test failed
[1] [Jun 19 11:07:20:462] ___________________
[1] [Jun 19 11:07:20:464] script finished: success
[1] [Jun 19 11:07:20:466] 0 errors
[1] [Jun 19 11:07:20:470] 0 warnings
[1] [Jun 19 11:07:20:471] 
[1] [Jun 19 11:07:20:473] 
[8] [Jun 19 11:07:20:475] End of CreateAndProcessScript
Ist dieses Verhalten beabsichtigt?

Ich bin mir fast sicher dass dies schonmal funktioniert hat. :?

Wenn ich die StringListe vor der Übergabe in eine entsprechende Variable stecke, funktioniert es.
Zuletzt geändert von larsg am 19 Jun 2018, 15:30, insgesamt 1-mal geändert.
Benutzeravatar
n.wenselowski
Ex-uib-Team
Beiträge: 3194
Registriert: 04 Apr 2013, 12:15

Re: Funktionsparameter StringList akzeptiert keine Übergabe von anderen Funktionen

Beitrag von n.wenselowski »

Hi,
larsg hat geschrieben:

Code: Alles auswählen

[1] [Jun 19 11:07:20:326] ============ Version 4.12.0.20 script "C:\Users\user\test.opsiscript"
Hier mal bitte mindestens Version 4.12.0.21 oder sogar 4.12.0.22 testen. Es gab dabei Verbesserungen beim Parsing.
larsg hat geschrieben:Ich bin mir fast sicher dass dies schonmal funktioniert hat. :?
Bug-Forum verwenden, wenn es vorher mal ging!!!


Gruß

Niko

Code: Alles auswählen

import OPSI
larsg
Beiträge: 283
Registriert: 16 Dez 2014, 18:06

Re: Funktionsparameter StringList akzeptiert keine Übergabe von anderen Funktionen

Beitrag von larsg »

Ok, danke!
n.wenselowski hat geschrieben:Bug-Forum verwenden, wenn es vorher mal ging!!!
War mir halt nicht ganz sicher.


Update:

Also, sowohl mit 4.12.0.21 als auch mit 4.12.0.22 bleibt das beschriebene Verhalten unverändert.
Im Übrigen besteht das gleiche Problem bei Stringverkettung in der Parameterübergabe.


Beispiel:

Code: Alles auswählen

[Actions]
DefFunc Test(Val $Test$:String):Void
   Comment $Test$
EndFunc

SetLogLevel=9
Test("a"+"b")
Erzeugt:

Code: Alles auswählen

[1] [Jun 19 15:21:55:769] --
[1] [Jun 19 15:21:55:769] --
[1] [Jun 19 15:21:55:770] c:\opsi.org\log\opsi-script-part-Dw26Os45.log
[1] [Jun 19 15:21:55:772] opsi-script 4.12.0.22 started at 19.06.2018 15:21:54
[1] [Jun 19 15:21:55:773] opsi-script log file with encoding utf8
[3] [Jun 19 15:21:55:773] readconfig failed: Perhaps got defaults 
[6] [Jun 19 15:21:55:774] Depot path from readconfig:  p:\
[6] [Jun 19 15:21:55:774] Restoring depot path from backup
[1] [Jun 19 15:21:55:775] Prog: force_min_loglevel: 4
[1] [Jun 19 15:21:55:775] Prog: default_loglevel: 7
[1] [Jun 19 15:21:55:776] Prog: debug_prog: False
[1] [Jun 19 15:21:55:776] Prog: debug_lib: True
[1] [Jun 19 15:21:55:777] Prog: ScriptErrorMessages: False
[1] [Jun 19 15:21:55:777] Prog: AutoActivityDisplay: False
[6] [Jun 19 15:21:55:778] Using new Depot path:  
[1] [Jun 19 15:21:55:780] 
[1] [Jun 19 15:21:55:780] ============ Version 4.12.0.22 script "C:\Users\user\test.opsiscript"
[1] [Jun 19 15:21:55:782]              used script encoding: cp1252
[1] [Jun 19 15:21:55:784]              used system encoding: cp1252
[1] [Jun 19 15:21:55:786]              start: 2018-06-19  15:21:55 
[1] [Jun 19 15:21:55:787]              on client named    "client"
[1] [Jun 19 15:21:55:789]              loggedin user    "user"
[1] [Jun 19 15:21:55:789]              opsi-script running as    "user"
[1] [Jun 19 15:21:55:790]              opsi-script running with admin privileges
[1] [Jun 19 15:21:55:791]              opsi-script running in standard script mode
[1] [Jun 19 15:21:55:792] executing: "C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-winst\winst32.exe"
[1] [Jun 19 15:21:55:793] system infos:
[1] [Jun 19 15:21:55:794] 94-65-9C-3D-AF-21  -  PC hardware address
[1] [Jun 19 15:21:55:797] client.fqdn.de  -  IP name
[1] [Jun 19 15:21:55:799] 192.168.56.1  -  IP address
[1] [Jun 19 15:21:55:801] MS Windows 10.0 64 Bit, Edition: Windows Enterprise 2015 LTSB
[1] [Jun 19 15:21:55:802] 
[7] [Jun 19 15:21:55:804] Registry started readonly
[7] [Jun 19 15:21:55:804] Registry started without redirection (64 Bit)
[6] [Jun 19 15:21:55:805] Registry key [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion]  opened
[6] [Jun 19 15:21:55:806] Key closed
[6] [Jun 19 15:21:55:845] Added defined function: test to the known functions
[6] [Jun 19 15:21:55:845] LogLevel was 7
[6] [Jun 19 15:21:55:846] LogLevel set to 9
[9] [Jun 19 15:21:55:847] Parsingprogress: r: Test("a"+"b") exp: 
[9] [Jun 19 15:21:55:848] Parsingprogress: r: ("a"+"b") exp: Test
[8] [Jun 19 15:21:55:850] We are coming from function with index: -1 (-1 = base)
[8] [Jun 19 15:21:55:851] We enter the defined function: test with 1 lines. inDefFuncLevel: 1
[8] [Jun 19 15:21:55:852] Paramnr: 0 is : "a"
[8] [Jun 19 15:21:55:853] Paramnr: 0 is the string: a
[2] [Jun 19 15:21:55:854] Syntax Error: Parameter parsing failed: ")" expected  , or ) expected.
[8] [Jun 19 15:21:55:855] We leave the defined function: test ; inDefFuncLevel: 0
[3] [Jun 19 15:21:55:855] Call of defined function: Test failed
[1] [Jun 19 15:21:55:858] ___________________
[1] [Jun 19 15:21:55:859] script finished: success
[1] [Jun 19 15:21:55:862] 0 errors
[1] [Jun 19 15:21:55:863] 0 warnings
[1] [Jun 19 15:21:55:863] 
[1] [Jun 19 15:21:55:864] 
[8] [Jun 19 15:21:55:865] End of CreateAndProcessScript
Interessant auch, das der Fehler nicht als solcher gewertet wird, selbst wenn ich FatalOnSyntaxError=true explizit setze.
Benutzeravatar
d.oertel
uib-Team
Beiträge: 3319
Registriert: 04 Jun 2008, 14:27

Re: Funktionsparameter StringList akzeptiert keine Übergabe von anderen Funktionen

Beitrag von d.oertel »

Hallo larsg,

danke für den Hinweis.

Ich habe mir dazu ein internes Ticket aufgemacht
und werde mich möglichstbald darum kümmern.

gruß
d.oertel
opsi support - uib gmbh

For productive opsi installations we recommend support contracts.
http://www.uib.de
http://www.opsi.org
Antworten