Seite 1 von 1

FireEvent "On demand" from opsi-script

Verfasst: 14 Jun 2022, 12:31
von M4t
Hello,

To follow up on this resolved request, Is there a way to call a FireEvent "On demand" from within a script ?
All this In order to trigger install of products with the actionRequest property at "setup" on the client running the script without rebooting.

Re: FireEvent "On demand" from script

Verfasst: 14 Jun 2022, 12:34
von m.radtke
hi

yeah its pretty simple

Code: Alles auswählen

opsi-admin method hostControlSafe_fireEvent on_demand $CLIENTID
Regards
Mathias

Re: FireEvent "On demand" from script

Verfasst: 14 Jun 2022, 13:09
von M4t
Thank you very much,
I may not have explained myself correctly.
I mean from an opsi-script script running on the client.
As we can trigger pending installations from systray, I would like to do this from an opsi-script script.
If you look at the linked post, I'm trying to install different bundles of packages right after the first deployment of the opsi-agent depending on the destination of the computer (currently the host group).

Re: FireEvent "On demand" from script

Verfasst: 14 Jun 2022, 14:10
von m.radtke
You can use rpc calls in opsi-script.

So therefore you can call the on_demand rpc call with the client name as a parameter.

Regards
Mathias

Re: FireEvent "On demand" from script

Verfasst: 14 Jun 2022, 15:54
von M4t
Very nice, thank you.

I used this :

Code: Alles auswählen

[OpsiServiceCall_fireEventOnDemand]
	"method": "hostControlSafe_fireEvent"
	"params": [
		"on_demand",
		"%HostID%"
	]
But it seems that the client does not have sufficient permissions to call this backend method, here is the logs :

Code: Alles auswählen

[3] [2022-06-14 15:38:04.702] [master]   Error: retrieveJSONObject --- opsi service problem ----> {"message":"Backend permission denied error: Access to method 'hostControlSafe_fireEvent' denied for user 'myHost.domain.tld'","class":"BackendPermissionDeniedError"}
(168)     [3] [2022-06-14 15:38:04.702] [master]   Received (first 512): {"id":1,"error":{"message":"Backend permission denied error: Access to method 'hostControlSafe_fireEvent' denied for user 'myHost.domain.tld'","class":"BackendPermissionDeniedError"},"result":null}
(169)     [3] [2022-06-14 15:38:04.703] [master]   Error: -> {"message":"Backend permission denied error: Access to method 'hostControlSafe_fireEvent' denied for user 'myHost.domain.tld'","class":"BackendPermissionDeniedError"}
any idea ?

EDIT: I replaced real hostid by "myHost.domain.tld"

Re: FireEvent "On demand" from opsi-script

Verfasst: 16 Jun 2022, 16:30
von M4t
Hello,

Somebody could help on this ?

Is there a trick to get permission to call method 'hostControlSafe_fireEvent' from opsi-script ?
What is the way used by systray to fire pending installs ? Can we reproduce this in opsi-script ?

Re: FireEvent "On demand" from opsi-script

Verfasst: 17 Jun 2022, 08:55
von m.radtke
Hi,

with opsi 4.2 we made a lot of changes to ACLs. You might want to take a look and change them to your needs.

Regards
Mathias