forked from Mirror/frr
tools: Add pathspace option to generate_support_bundle
Adding a `-N` pathspace option to the generate_support_bundle.py to support FRR running in a non-default namespace with a prefix on the config/socket options. The same pathspace will be prepended to the output log files (if specified) Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
This commit is contained in:
parent
86f66afc52
commit
9acadf8d3f
|
@ -32,6 +32,9 @@ def main():
|
|||
parser.add_argument(
|
||||
"-l", "--log-dir", default="/var/log/frr", help="directory for logfiles"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-N", "--pathspace", help="Insert prefix into config & socket paths"
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
collecting = False # file format has sentinels (seem superfluous)
|
||||
|
@ -69,6 +72,15 @@ def main():
|
|||
# Spawn a vtysh to fetch each set of commands
|
||||
procs = []
|
||||
for proc in proc_cmds:
|
||||
if args.pathspace:
|
||||
ofn = os.path.join(args.log_dir, args.pathspace + "_" + proc + "_support_bundle.log")
|
||||
p = subprocess.Popen(
|
||||
["/usr/bin/env", "vtysh", "-t", "-N", args.pathspace],
|
||||
stdin=proc_cmds[proc],
|
||||
stdout=open_with_backup(ofn),
|
||||
stderr=subprocess.STDOUT,
|
||||
)
|
||||
else:
|
||||
ofn = os.path.join(args.log_dir, proc + "_support_bundle.log")
|
||||
p = subprocess.Popen(
|
||||
["/usr/bin/env", "vtysh", "-t"],
|
||||
|
|
Loading…
Reference in a new issue