FireEvent "On demand" from opsi-script

Antworten
M4t
Beiträge: 9
Registriert: 24 Mai 2022, 14:48

FireEvent "On demand" from opsi-script

Beitrag 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.
Zuletzt geändert von M4t am 15 Jun 2022, 14:45, insgesamt 1-mal geändert.
Opsi 4.2 - Rocky Linux 8
Benutzeravatar
m.radtke
Ex-uib-Team
Beiträge: 1767
Registriert: 10 Jun 2015, 12:19

Re: FireEvent "On demand" from script

Beitrag von m.radtke »

hi

yeah its pretty simple

Code: Alles auswählen

opsi-admin method hostControlSafe_fireEvent on_demand $CLIENTID
Regards
Mathias


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


M4t
Beiträge: 9
Registriert: 24 Mai 2022, 14:48

Re: FireEvent "On demand" from script

Beitrag 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).
Opsi 4.2 - Rocky Linux 8
Benutzeravatar
m.radtke
Ex-uib-Team
Beiträge: 1767
Registriert: 10 Jun 2015, 12:19

Re: FireEvent "On demand" from script

Beitrag 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


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


M4t
Beiträge: 9
Registriert: 24 Mai 2022, 14:48

Re: FireEvent "On demand" from script

Beitrag 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"
Opsi 4.2 - Rocky Linux 8
M4t
Beiträge: 9
Registriert: 24 Mai 2022, 14:48

Re: FireEvent "On demand" from opsi-script

Beitrag 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 ?
Opsi 4.2 - Rocky Linux 8
Benutzeravatar
m.radtke
Ex-uib-Team
Beiträge: 1767
Registriert: 10 Jun 2015, 12:19

Re: FireEvent "On demand" from opsi-script

Beitrag 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


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


Antworten