From 302c264ece7dfae89e16e98ef5d901c7172a4919 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Tue, 5 Sep 2023 13:03:21 -0500 Subject: save-config: T5551: check if None before write, as is the case at boot (cherry picked from commit 3fe5482a29042c92298d3e69d90c0c38404d2fcc) --- src/helpers/vyos-save-config.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/helpers') diff --git a/src/helpers/vyos-save-config.py b/src/helpers/vyos-save-config.py index 2812155e8..8af4a7916 100755 --- a/src/helpers/vyos-save-config.py +++ b/src/helpers/vyos-save-config.py @@ -44,7 +44,10 @@ ct = config.get_config_tree(effective=True) write_file = save_file if remote_save is None else NamedTemporaryFile(delete=False).name with open(write_file, 'w') as f: - f.write(ct.to_string()) + # config_tree is None before boot configuration is complete; + # automated saves should check boot_configuration_complete + if ct is not None: + f.write(ct.to_string()) f.write("\n") f.write(system_footer()) -- cgit v1.2.3