summaryrefslogtreecommitdiff
path: root/python/vyos/system/image.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2024-01-22 21:01:00 -0600
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-01-23 19:11:30 +0000
commit0cf188d74f145cdd859bb1495a2b02f16fca6298 (patch)
tree5f0bcfebfc4f1745ece8e3f7935818128bbaf98e /python/vyos/system/image.py
parent4276133800e9aa5d5fb5a17faad77b185a68c7c3 (diff)
downloadvyos-1x-0cf188d74f145cdd859bb1495a2b02f16fca6298.tar.gz
vyos-1x-0cf188d74f145cdd859bb1495a2b02f16fca6298.zip
image-tools: T5980: add support for configurable kernel boot options
(cherry picked from commit 1b1569d5b88a20994fc65fd529f8103db371bf3f)
Diffstat (limited to 'python/vyos/system/image.py')
-rw-r--r--python/vyos/system/image.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/python/vyos/system/image.py b/python/vyos/system/image.py
index 514275654..5460e6a36 100644
--- a/python/vyos/system/image.py
+++ b/python/vyos/system/image.py
@@ -1,4 +1,4 @@
-# Copyright 2023 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2023-2024 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -15,6 +15,7 @@
from pathlib import Path
from re import compile as re_compile
+from functools import wraps
from tempfile import TemporaryDirectory
from typing import TypedDict
@@ -262,6 +263,16 @@ def is_live_boot() -> bool:
return True
return False
+def if_not_live_boot(func):
+ """Decorator to call function only if not live boot"""
+ @wraps(func)
+ def wrapper(*args, **kwargs):
+ if not is_live_boot():
+ ret = func(*args, **kwargs)
+ return ret
+ return None
+ return wrapper
+
def is_running_as_container() -> bool:
if Path('/.dockerenv').exists():
return True