Calling Bird2 from Python script fails

Stavros Konstantaras stavros.konstantaras at ams-ix.net
Thu Nov 24 14:09:38 CET 2022


Hi all,

I am trying to automate Bird2 configuration with Python3 and I faced this strange issue:


  *   If I generate a part of the config which is included in the main config file and then I call “birdc configure”  via os.system() function, the new configuration is ignored.


  *   If I generate a full config and I call “birdc configure” via os.system() function, I get the strange error
“bird2_control.conf:1:1 No protocol is specified in the config file”
Which is strange because the first line of my config is a big comment that can be ignored.



  *   If myself execute ““birdc configure” without touching/changing anything in the config, it is accepted and executed immediately without issues !!!


Things I tried so far to overcome the issue:

  *   I used subprocess.run() but didn’t have any luck
  *   Tried to use a 2s sleep between writing the new config and reloading bird2, didn’t work
  *   I used python2 instead of python3 but still didn’t have any luck
  *   I executed “birdc configure” via a BASH script, still didn’t work
  *   User and file permissions checked, now problem.

Anyone has experienced this weird problem before and has a suggestion to overcome it? It seems to be a birdc issue and doesn’t like to be called from scripts.

FYI, I use Bird 2.0.10 on CentOS 7 and Python 3.6.8


Kind Regards

Stavros
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20221124/72d2f3b4/attachment.htm>


More information about the Bird-users mailing list