Set a list as productproperty of a package ?

Antworten
nicolaslebrun
Beiträge: 107
Registriert: 18 Apr 2011, 11:43

Set a list as productproperty of a package ?

Beitrag von nicolaslebrun »

Hi,

On my server,

Code: Alles auswählen

opsi-admin -dr method getProductProperties_hash opsi-clonezilla nomdemachine.fqdn.fr
{"setup_after_install": "opsi-domain-join,opsi-patch-domain-seven", "drbl_ocs_conf": "", "mount_image_share": "False", "imageshare": "//opsiserver/opsi_images", "askbeforeinst": "True", "imagefile": "une-image", "rebootflag": "reboot", "architecture": "32bit", "runcommand": "ocs-live"}
The value of setup_after_install is a list ... But I can't change this list...

If i make

Code: Alles auswählen

opsi-admin -dr method setProductProperty opsi-clonezilla setup_after_install  [windomain,jedit,javavm]
The value is created, but it is a string, not a list... I tried to set a list with { or ' ... but i can't get it working ...

Any idea ?

Greetings,

Nicolas Lebrun
Benutzeravatar
n.wenselowski
Ex-uib-Team
Beiträge: 3194
Registriert: 04 Apr 2013, 12:15

Re: Set a list as productproperty of a package ?

Beitrag von n.wenselowski »

Hello Nicolas,

for the update you are working with JSON. To create a list you use square brackes - [ ].
Try this:

Code: Alles auswählen

"setup_after_install": ["opsi-domain-join", "opsi-patch-domain-seven"]

With kind regards

Niko

Code: Alles auswählen

import OPSI
nicolaslebrun
Beiträge: 107
Registriert: 18 Apr 2011, 11:43

Re: Set a list as productproperty of a package ?

Beitrag von nicolaslebrun »

Thanks Niko for your answer... i hadn't seen till today...

I just tried many solutions :

Code: Alles auswählen

opsi-admin -dr method setProductProperty opsi-clonezilla "setup_after_install"  ["opsi-domain-join", "opsi-patch-domain-seven"]
doesn't work. Too many arguments.

Code: Alles auswählen

opsi-admin -dr method setProductProperty opsi-clonezilla "setup_after_install"  [ "opsi-domain-join" , "opsi-patch-domain-seven" ]
doesn't work. Too many arguments.

It seem's opsi-admin parses on space caracters...

Code: Alles auswählen

opsi-admin -d method setProductProperty opsi-clonezilla "setup_after_install"  ["opsi-domain-join","opsi-patch-domain-seven"]
seems too work.
But, ["opsi-domain-join","opsi-patch-domain-seven"] is used as a string...

If I try with a colon, with space or not

Code: Alles auswählen

opsi-admin  -dr method setProductProperty opsi-clonezilla "setup_after_install" : ["opsi-domain-join","opsi-patch-domain-seven"]
i get too many or too few arguments...

well, sorry, Niko, but I can't get it working...

Regards,

Nico
nicolaslebrun
Beiträge: 107
Registriert: 18 Apr 2011, 11:43

Re: Set a list as productproperty of a package ?

Beitrag von nicolaslebrun »

Another try,

None of these intructions give an error...
But I can't get a list value for setup_after_install ...

Code: Alles auswählen

opsi-admin -d method setProductProperties opsi-clonezilla '{"setup_after_install":["opsi-domain-join,opsi-patch-domain-seven"], "drbl_ocs_conf": "", "runcommand": "ocs-live", "imageshare": "//opsi/opsi_images", "askbeforeinst": "False", "imagefile": "ChoisirLeNomDeLIMage", "rebootflag": "halt", "architecture": "32bit", "mount_image_share": "True"}'

Code: Alles auswählen

opsi-admin -d method setProductProperties opsi-clonezilla '{"setup_after_install":["opsi-domain-join","opsi-patch-domain-seven"], "drbl_ocs_conf": "", "runcommand": "ocs-live", "imageshare": "//opsi/opsi_images", "askbeforeinst": "False", "imagefile": "ChoisirLeNomDeLIMage", "rebootflag": "halt", "architecture": "32bit", "mount_image_share": "True"}'

Code: Alles auswählen

opsi-admin -d method setProductProperties opsi-clonezilla '{"setup_after_install": ["opsi-domain-join","opsi-patch-domain-seven"], "drbl_ocs_conf": "", "runcommand": "ocs-live", "imageshare": "//opsi/opsi_images", "askbeforeinst": "False", "imagefile": "ChoisirLeNomDeLIMage", "rebootflag": "halt", "architecture": "32bit", "mount_image_share": "True"}'
I really think it isn't well parsed...

Regards
Benutzeravatar
n.wenselowski
Ex-uib-Team
Beiträge: 3194
Registriert: 04 Apr 2013, 12:15

Re: Set a list as productproperty of a package ?

Beitrag von n.wenselowski »

Hello Nicolas,
nicolaslebrun hat geschrieben:I really think it isn't well parsed...
This probably is the problem.

The most easy solution I can currently think of is to use the configed in a current version to set the properties you want through the GUI. To do this select the depot view and then change to the default properties tab.
Another alternative would be to re-package the product with the settings you want and reinstall it with the option --properties package.
The last thing would be to connect through the opsi-backend through a script and then do the setting you want.


With kind regards

Niko

Code: Alles auswählen

import OPSI
nicolaslebrun
Beiträge: 107
Registriert: 18 Apr 2011, 11:43

Re: Set a list as productproperty of a package ?

Beitrag von nicolaslebrun »

Thks Niko,

But we have about 150 opsi servers and I can't imagine doing this with configed ...

I hope it will be possible in a next release of opsi-admin...

Must I open an issue ?

Regards,

Nico
Benutzeravatar
n.wenselowski
Ex-uib-Team
Beiträge: 3194
Registriert: 04 Apr 2013, 12:15

Re: Set a list as productproperty of a package ?

Beitrag von n.wenselowski »

Hello Nico,
nicolaslebrun hat geschrieben:But we have about 150 opsi servers and I can't imagine doing this with configed ...
Please give it a try. Editing multiple depots is possible by just seleting them - or pressing ++ to have all depots selected.
nicolaslebrun hat geschrieben:I hope it will be possible in a next release of opsi-admin...

Must I open an issue ?
I did open one. No guarantee that this will be fixed in the next version though.

If it is important for you just contact us through support. With that many depots i'm sure you have a support contract ;)


With kind regards

Niko

Code: Alles auswählen

import OPSI
nicolaslebrun
Beiträge: 107
Registriert: 18 Apr 2011, 11:43

Re: Set a list as productproperty of a package ?

Beitrag von nicolaslebrun »

Hi Niko,
Please give it a try. Editing multiple depots is possible by just seleting them - or pressing ++ to have all depots selected.
But we have 150 opsi servers ... not 150 opsi depots ! About 30000 clients... and the choice made two years ago, was to have 150 servers...

Nico
Benutzeravatar
wolfbardo
uib-Team
Beiträge: 1354
Registriert: 01 Jul 2008, 12:10

Re: Set a list as productproperty of a package ?

Beitrag von wolfbardo »

Hi Nicolas,
nicolaslebrun hat geschrieben:
But we have 150 opsi servers ... not 150 opsi depots ! About 30000 clients...

Nico
great.

We recommend for productiv opsi environments a support contract with uib gmbh.

Regarding your question:

Code: Alles auswählen

setProductProperty
is a legacy opsi3-method.

Some of them are very usefull, others may become depricated.

As Nico mentioned, one workaround is
n.wenselowski hat geschrieben: ... to re-package the product with the settings you want and reinstall it with the option --properties package.

With kind regards

Niko
Another possibility is working analogous viewtopic.php?t=3017

Code: Alles auswählen

 opsi-admin -d method productProperty_getObjects [] '{"productId":"opsi-clonezilla"}' > /tmp/property_config.json
edit

Code: Alles auswählen

/tmp/property_config.json
and

Code: Alles auswählen

opsi-admin -d method productProperty_updateObjects < /tmp/property_config.json
check with

Code: Alles auswählen

opsi-admin -d method getProductProperties_hash opsi-clonezilla
regards,
bardo wolf


OPSICONF 2024
https://opsi.org/en/opsiconf/

opsi-Basisworkshops:

22. - 25. 04. 2024


opsi support - uib gmbh
For productive opsi installations we recommend maintainance + support contracts which are the base of opsi development.

http://www.uib.de
Benutzeravatar
n.wenselowski
Ex-uib-Team
Beiträge: 3194
Registriert: 04 Apr 2013, 12:15

Re: Set a list as productproperty of a package ?

Beitrag von n.wenselowski »

Hi,

as to answer to the initial problem: this seems to have been an problem in setProductProperty / setProductProperties.
This seems to have not been an problem with opsi-admin but the method.
There is a corrected version in python-opsi 4.0.7.58 for opsi 4.0 and 4.1.1.30 for opsi 4.1.

Feedback is welcome for this!


Kind regards

Niko

Code: Alles auswählen

import OPSI
Antworten