Author Topic: Network object members creation from bash script  (Read 1543 times)

cramirez

  • Zen Apprentice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Network object members creation from bash script
« on: December 29, 2014, 07:09:43 pm »
Hi guys,

I need to dinamically add members to a network object group. Does anyone know if this is possible from a bash script? I read that Zentyal uses redis to store configuration. Is the network object members saved in redis? Maybe I could use that if possible.

I'm using Zentyal 3.5. Appreaciate any help folks.

jbahillo

  • Zentyal Staff
  • Zen Hero
  • *****
  • Posts: 1444
  • Karma: +77/-2
    • View Profile
Re: Network object members creation from bash script
« Reply #1 on: January 02, 2015, 12:59:45 pm »
Yes, you can but I'm not sure any script of this kind has been already done. You should use Zentyal API in order to achieve this.

For instance this is the procedure which created an object: https://github.com/Zentyal/zentyal/blob/master/main/objects/src/EBox/Objects.pm#L299-L303 , or this one is the procedure to insert an object member into an object  https://github.com/Zentyal/zentyal/blob/master/main/objects/src/EBox/Objects.pm#L306-L348


cramirez

  • Zen Apprentice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Network object members creation from bash script
« Reply #2 on: January 16, 2015, 09:50:46 pm »
Thank you so much jbahillo :D. I was not aware of the existence of such an API.

Thanks to your reply I was able to find a very good example of object management through the Zentyal API. I will paste here for future reference:

https://github.com/Zentyal/zentyal/blob/87ca498f5e25f984f7909e2a12ef445d6bd53b0a/extra/migration-tool/zentyal/src/scripts/import-dhcp

Although I have not finished the script yet, I already have all I need.

jbahillo

  • Zentyal Staff
  • Zen Hero
  • *****
  • Posts: 1444
  • Karma: +77/-2
    • View Profile
Re: Network object members creation from bash script
« Reply #3 on: January 19, 2015, 11:40:08 pm »
Yes, pplease share if you don't mind, I'm sure other community members will thank you ;)