Product Dependency based on Product Property

Antworten
bobzbobz
Beiträge: 169
Registriert: 30 Nov 2012, 10:41
Wohnort: Denmark

Product Dependency based on Product Property

Beitrag 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
Benutzeravatar
r.roeder
uib-Team
Beiträge: 540
Registriert: 02 Jul 2008, 10:08

Re: Product Dependency based on Product Property

Beitrag 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


Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.

Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.

uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de


bobzbobz
Beiträge: 169
Registriert: 30 Nov 2012, 10:41
Wohnort: Denmark

Re: Product Dependency based on Product Property

Beitrag von bobzbobz »

Hi Rupert

Okay, i will try this.
But do you have any examples?

Best Regards,
Soren
Benutzeravatar
r.roeder
uib-Team
Beiträge: 540
Registriert: 02 Jul 2008, 10:08

Re: Product Dependency based on Product Property

Beitrag 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


Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.

Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.

uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de


bobzbobz
Beiträge: 169
Registriert: 30 Nov 2012, 10:41
Wohnort: Denmark

Re: Product Dependency based on Product Property

Beitrag 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"
  ]
Benutzeravatar
wolfbardo
uib-Team
Beiträge: 1412
Registriert: 01 Jul 2008, 12:10

Re: Product Dependency based on Product Property

Beitrag 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$"
           ]


Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.

Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.

uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de


bobzbobz
Beiträge: 169
Registriert: 30 Nov 2012, 10:41
Wohnort: Denmark

Re: Product Dependency based on Product Property

Beitrag von bobzbobz »

Hi Bardo

Works like a charm ;-)

Guess i was using the wrong servicecall.

setProductState should be setActionRequestStatus
Antworten