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
committerJohn Estabrook <jestabro@vyos.io>2024-01-23 10:32:15 -0600
commit1b1569d5b88a20994fc65fd529f8103db371bf3f (patch)
treef661f4782f27c9ea03c49fcabe288e4e361cc4bd /python/vyos/system/image.py
parent4c2d4519277bc4cbe964a37160b93c31cdc77309 (diff)
downloadvyos-1x-1b1569d5b88a20994fc65fd529f8103db371bf3f.tar.gz
vyos-1x-1b1569d5b88a20994fc65fd529f8103db371bf3f.zip
image-tools: T5980: add support for configurable kernel boot options
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