Seite 1 von 1

GetProductPropertyList ohne Auswahl...

Verfasst: 07 Sep 2020, 16:47
von thomas.besser
Hallo,

habe ein sehr seltsames Problem. Ich will eine ProductProperty-Liste, die als default keine Vorauswahl hat...

Code: Alles auswählen

description: 
advice: 
version: 1.0
priority: 0
licenseRequired: False
productClasses: 
setupScript: setup.opsiscript
uninstallScript: 
updateScript: 
alwaysScript: 
onceScript: 
customScript: 
userLoginScript: 

[ProductProperty]
type: unicode
name: test
multivalue: True
editable: True
values: ["test1", "test2"]
default: []

Code: Alles auswählen

[Actions]
DefStringlist $List$

Set $List$ = GetProductPropertyList("test","")

if (count($List$) = "0")
	comment "No choice made. Nothing to do" 
else
	comment "A choice was made"
endif
Ergibt...

Code: Alles auswählen

(93)      [6] [2020-09-07 16:37:14.289] [test_pp-list-null] Set  $List$ = GetProductPropertyList("test","")
(98)      [7] [2020-09-07 16:37:14.717] [test_pp-list-null]   The value of the variable "$List$" is now:
(99)      [6] [2020-09-07 16:37:14.734] [test_pp-list-null] If
(100)     [7] [2020-09-07 16:37:14.745] [test_pp-list-null]   count($List$) = "0"   <<< result true
(101)     [6] [2020-09-07 16:37:14.745] [test_pp-list-null]   (count($List$) = "0")   <<< result true
(102)     [6] [2020-09-07 16:37:14.745] [test_pp-list-null] Then
(103)     [5] [2020-09-07 16:37:14.745] [test_pp-list-null]   comment: No choice made. Nothing to do
(104)     [6] [2020-09-07 16:37:14.745] [test_pp-list-null] Else
(105)     [6] [2020-09-07 16:37:14.745] [test_pp-list-null] EndIf
Bis hierher alles, wie ich es erwarten würde.

Verwende diesen Konstrukt 'if (count($List$) = "0")' in einem Skript mehrfach. Er funktioniert genau _einmal_ nicht...

Code: Alles auswählen

[6] [2020-09-07 16:28:15.657] [o4i_firefox-esr]   Set  $ListPolFromProperty$ = GetProductPropertyList("policy_popup_blocking","")
[7] [2020-09-07 16:28:16.025] [o4i_firefox-esr]     The value of the variable "$ListPolFromProperty$" is now:
[7] [2020-09-07 16:28:16.025] [o4i_firefox-esr]     (string   0)
[6] [2020-09-07 16:28:16.034] [o4i_firefox-esr]   If
[7] [2020-09-07 16:28:16.036] [o4i_firefox-esr]     count($ListPolFromProperty$) = "0"   <<< result false
[6] [2020-09-07 16:28:16.036] [o4i_firefox-esr]     (count($ListPolFromProperty$) = "0")   <<< result false
[6] [2020-09-07 16:28:16.036] [o4i_firefox-esr]   Then
opsi-winst-Version ist 4.12.4.0 (testing).

Hat jemand eine Ahnung/Idee warum diese eine fehlschlagen könnte? Ich habe den Code mehrmals durchgelesen, ich sehe keine Unterschiede zu den funktionierenden.

Oder wie macht ihr das mit GetProductPropertyList, wenn es keine Vorauswahl als Default geben soll?

Danke und Gruß
Thomas

Re: GetProductPropertyList ohne Auswahl...

Verfasst: 09 Sep 2020, 08:59
von thomas.besser
Moin,

das Phänomen hat sich geklärt. Es hängt mit dem OPSI-Server selbst und wann, welche Version von o4i_firefox-esr installiert wurde zusammen.

Bzgl. o4i_firefox-esr war ein vorherige Version mit einem Paketdefault von [""] definiert, welcher nachträglich auf [] gesetzt wurde, damit die if (count($List$) = "0") funktioniert. Da bei Paket-Updates aber die Depot-Defaults behalten werden, löste das Problem erst ein 'opsi-package-manger -p package'. Allerdings für _alle_ Properties.

In diesem speziellen Fall "leere Auswahl" (= [""]) vs. "keine Auswahl" ( = []) habe ich aber keine Möglichkeit gefunden, das einzeln zurückzusetzen. (Außer in den config-files bzw. -Datenbank rumzuwerkeln). Irgendeine Idee, wie man das _nur_ für einzelne zurücksetzen kann?

Gruß
Thomas