Seite 1 von 1
Product Dependency based on Product Property
Verfasst: 25 Feb 2013, 14:19
von bobzbobz
Hi
Is it possible to have a Product Dependency based on a Product Property?
We have this program, where "normal users" just use the program without any other programs needed.
If the user is an "admin" he needs another program to be installed for it to work.
Now i would like to create a product property called "Admin" with the options "yes/no".
If the property is "yes" then the package should have a product dependency on the other program.
Best Regards
Soren Birk
Re: Product Dependency based on Product Property
Verfasst: 25 Feb 2013, 18:48
von r.roeder
Hi,
bobzbobz hat geschrieben:
Is it possible to have a Product Dependency based on a Product Property?
this exactly is not possible but you could solve your problem in your script by using winst OpsiServiceCall sections (ask the service if the product is installed, set the product to setup if necessary)
Regards!
Rupert
Re: Product Dependency based on Product Property
Verfasst: 26 Feb 2013, 08:25
von bobzbobz
Hi Rupert
Okay, i will try this.
But do you have any examples?
Best Regards,
Soren
Re: Product Dependency based on Product Property
Verfasst: 26 Feb 2013, 20:15
von r.roeder
Hi Soren,
bobzbobz hat geschrieben:
But do you have any examples
your guess that the task is not very simple is right and the documentation at this point is rather short. I will try a sketch how it should work (not tested).
The part of the script for the case admin should look like:
Code: Alles auswählen
DefVar $myProduct$
Set $myProduct$ = "xxxx"
DefVar $isInstalled$
set $isInstalled$ = "false"
Def StringList resultlist
Set resultlist=getReturnListFromSection("opsiservicecall_installedProducts")
for %product% in resultlist do sub_testcontained
if $isInstalled$ = "false"
opsiservicecall_setSetup
endif
[sub_testcontained]
if "%product%" = $myProduct$
set $isInstalled$ = "true"
endif
[opsiservicecall_installedProducts]
"method" : "getInstalledProductIds_list"
"params" : [
"%hostId%"
]
[opsiservicecall_setSetup]
"method" : "setProductState"
"params" : [
"$myproduct",
"%hostId%",
"installationStatus": "not_installed",
"actionRequest": "setup"
]
I hope it works
Regards
Rupert
Re: Product Dependency based on Product Property
Verfasst: 28 Feb 2013, 15:36
von bobzbobz
Hi Rupert
I have tried your idea, but i get this error in the log:
Code: Alles auswählen
[5] [feb 28 15:28:51:933] Execution of opsiservicecall_setSetup
[6] [feb 28 15:28:51:933] "method": "setProductState"
[6] [feb 28 15:28:51:933] Calling opsi service at https://172.16.0.3:4447
[6] [feb 28 15:28:51:933] JSON service request https://172.16.0.3:4447/rpc setProductState
[6] [feb 28 15:28:52:042] JSON Bench for setProductState "params":["alternatiff","opsi-client.fmts.lan","in Start: 15:28:51:933 Time: 00:00:00:109
[3] [feb 28 15:28:52:046] Error: retrieveJSONObject --- opsi service problem ----> {"message":"Bad installation status: 'installationstatus'","class":"ValueError"}
[3] [feb 28 15:28:52:046] Error: -> {"message":"Bad installation status: 'installationstatus'","class":"ValueError"}
This is my opsiservicecall_setSetup-section:
Code: Alles auswählen
[opsiservicecall_setSetup]
"method": "setProductState"
"params": [
"$Alternatiff$",
"%hostId%",
"installationStatus":"not_installed",
"actionRequest":"setup"
]
Re: Product Dependency based on Product Property
Verfasst: 01 Mär 2013, 09:52
von wolfbardo
Hi Soren,
An working example for setting something to "setup"
Code: Alles auswählen
comment "Set office_2010_hotfix=setup"
Set $ActionRequest$ = 'setup'
Set $SetupProductId$ = 'office_2010_hotfix'
opsiServiceCall_setActionRequestStatus
comment "Need a reboot to force the installation"
Code: Alles auswählen
comment "Need a reboot to force the installation"
ExitWindows /Reboot
...
[opsiServiceCall_setActionRequestStatus]
"method": "setProductActionRequest"
"params": [
"$SetupProductId$",
"$ClientId$",
"$ActionRequest$"
]
Re: Product Dependency based on Product Property
Verfasst: 01 Mär 2013, 12:59
von bobzbobz
Hi Bardo
Works like a charm
Guess i was using the wrong servicecall.
setProductState should be setActionRequestStatus