Calling Bird2 from Python script fails

Gerdriaan Mulder gmulder+birdcz at freedom.nl
Sat Nov 26 15:01:22 CET 2022


Hi Stavros,

Could you share any of the Python3 scripts you used? This may help in 
debugging / reproducing your issue.

A few thoughts in the meantime:
- are there any other BIRD processes running on the system involved?
- if so, are you connecting to the correct control socket?
- are you sure all buffers (i.e. for the configuration file) have been 
flushed before calling birdc configure?
- did you capture any output from birdc reconfigure? (Bird 2.0.10 on 
Ubuntu 20.04, though compiled from source, says "Reading configuration 
from /etc/bird.conf")
- if so, did the correct configuration filename come up?

Best regards,
Gerdriaan Mulder

On 24/11/2022 14:09, Stavros Konstantaras via Bird-users wrote:
> 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
> 


More information about the Bird-users mailing list