summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-09-05 13:03:21 -0500
committerJohn Estabrook <jestabro@vyos.io>2023-09-05 13:07:23 -0500
commit302c264ece7dfae89e16e98ef5d901c7172a4919 (patch)
treef1560b11ee8b87159410bec0f940bae6dbf8a432
parent8e22a2f6f77dc2d10969d8603c59a8834164b903 (diff)
downloadvyos-1x-302c264ece7dfae89e16e98ef5d901c7172a4919.tar.gz
vyos-1x-302c264ece7dfae89e16e98ef5d901c7172a4919.zip
save-config: T5551: check if None before write, as is the case at boot
(cherry picked from commit 3fe5482a29042c92298d3e69d90c0c38404d2fcc)
-rwxr-xr-xsrc/helpers/vyos-save-config.py5
1 files changed, 4 insertions, 1 deletions
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())