Seite 1 von 1

Syntax createProductPropertyDefinition

Verfasst: 23 Feb 2011, 11:49
von thomas.besser
Hallo,

bin noch auf OPSI 3.4 und versuche verzweifelt, eine ProductProperty anzulegen.

thomas@far-opsi:~$ opsi-admin -d method createProductPropertyDefinition "winxppro" "test" "Test" "foo" ["foo" "bar"]
Traceback:
line 1448 in '<module>' in file '/usr/bin/opsi-admin'
line 439 in 'exit' in file '/usr/bin/opsi-admin'
==>>> Failed to execute 'method createProductPropertyDefinition winxppro test Test foo [foo bar]': Expecting object: line 1 column 1 (char 1)
ERROR: Failed to execute 'method createProductPropertyDefinition winxppro test Test foo [foo bar]': Expecting object: line 1 column 1 (char 1)

Im Handbuch S. 32 steht: method createProductPropertyDefinition productId, name, description=None, defaultValue=None, possibleValues=[]

Wie gebe ich den Wert für "possibleValues=[]" richtig an?

Danke und Gruß
Thomas Besser

Re: Syntax createProductPropertyDefinition

Verfasst: 23 Feb 2011, 12:43
von j.schneider

Code: Alles auswählen

opsi-admin -d method createProductPropertyDefinition "winxppro" "test" "Test" "foo" '["foo","bar"]'
sollte funktionieren.

Re: Syntax createProductPropertyDefinition

Verfasst: 23 Feb 2011, 15:37
von thomas.besser
Das hat funktioniert. Aber ich wäre im Leben nicht darauf gekommen.

Danke und Gruß
Thomas Besser

Re: Syntax createProductPropertyDefinition

Verfasst: 23 Feb 2011, 16:25
von j.schneider
Alle Parameter müssen in JSON-Syntax übergeben werden.
http://www.json.org/

Code: Alles auswählen

["foo","bar"]
ist ein String-Array
Zusätzlich muss man manche Parameter "escapen".

Code: Alles auswählen

["foo", "bar"]
ist erlaubte JSON-Syntax, jedoch würde opsi-admin wegen des Leerzeichens 2 Parameter vermuten.
Die Verwendung von

Code: Alles auswählen

'["foo", "bar"]'
verhindert das.