New opsi-script with local functions

Beiträge: 3288
Registriert: 04 Jun 2008, 14:27

New opsi-script with local functions

Beitragvon d.oertel » 26 Jul 2017, 17:36

Dear opsi-users,

Normally we do not comment any publication in the experimental branch.
In this case we want to introduce to you the new features of the opsi-script (winst) 4.12.0
before every thing is fixed and can't be changed any more.
This would be the case if we publish it as testing.

The hereby published packages are stable and may be used productive (we do not know any new problems).
The experimental part are the new functions.

The focus of this new release is the introduction of defined local functions:
(This is a concept that is normally well known to all programmers,
but may irritate people that see something like that the first time).
There are a lot possibilities to structure opsi-script code:

* `sub` Sections
* `sub` Sections in external files
* 'include' Statements

But all these possibilities are not functional to create reusable external code
that can be exchanged between scripts or opsi administrators without problems.
The reason is, that this code is not encapsulated and use global variables.
The defined local functions presented here now solves this problem.
With this concept it is possible to write functions that can be collected and maintained in external libraries.
In consequence we will start to build up a central opsi-script library which is maintained by uib and the opsi community.

In order to reach this target we have implemented the following concepts:

* Functions with return value
* Freely definable function call parameters
* Local Variables
* Nested functions
* Recursive calls
* Primary and secondary sections within functions

More details you will find at the opsi-script 4.12 release notes and at the opsi-script-manual:

Published packages:
opsi-script for Windows (winst):
opsi-script-test: Test and Examples (for Windows and Linux):
opsi-script within the opsi-linux-client-agent:

Any feedback is welcome.

Kind regards,

detlef oertel
opsi support - uib gmbh

For productive opsi installations we recommend support contracts.