]> git.puffer.fish Git - matthieu/frr.git/commit
tools: fix backing up previous logs in generate_support_bundle.py
authorJonas Gorski <jonas.gorski@bisdn.de>
Wed, 15 Dec 2021 09:33:33 +0000 (10:33 +0100)
committerJonas Gorski <jonas.gorski@bisdn.de>
Wed, 15 Dec 2021 09:41:49 +0000 (10:41 +0100)
commitb321edc51b6c8c402485b92f0603ce9f41737ee4
tree58a9a72656be2fa2db4c2211b4b18e25e2dec478
parent2c32234f11874b75ed61dece01f9f5e384ac61b2
tools: fix backing up previous logs in generate_support_bundle.py

subprocess.check_call needs to be called with shell=True, else it will
interpret the string as a single path to execute instead of a command
with arguments:

Fixes the following error:

$ /usr/lib/frr/generate_support_bundle.py
Making backup of /var/log/frr/bgp_support_bundle.log
Traceback (most recent call last):
  File "/usr/lib/frr/generate_support_bundle.py", line 89, in <module>
    main()
  File "/usr/lib/frr/generate_support_bundle.py", line 80, in main
    stdout=open_with_backup(ofn),
  File "/usr/lib/frr/generate_support_bundle.py", line 32, in open_with_backup
    subprocess.check_call("mv {0} {0}.prev".format(path))
  File "/usr/lib/python3.8/subprocess.py", line 359, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python3.8/subprocess.py", line 340, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'mv /var/log/frr/bgp_support_bundle.log /var/log/frr/bgp_support_bundle.log.prev'

Fixes: 5417cc2de ("tests: collect support bundle data in parallel, fix bugs")
Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
tools/generate_support_bundle.py