summaryrefslogtreecommitdiff
path: root/python/vyos/system/image.py
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2024-01-23 19:10:20 +0000
committerGitHub <noreply@github.com>2024-01-23 19:10:20 +0000
commitd736a9b70ca897bdf1e0237b64ab5c7eb958b520 (patch)
treeeb4c7c191a126ecd6c4e9dec1da224c0b60b60fe /python/vyos/system/image.py
parent4c2d4519277bc4cbe964a37160b93c31cdc77309 (diff)
parent256346a66cc3bb20e93c68245ebca2f68f42e7b5 (diff)
downloadvyos-1x-d736a9b70ca897bdf1e0237b64ab5c7eb958b520.tar.gz
vyos-1x-d736a9b70ca897bdf1e0237b64ab5c7eb958b520.zip
Merge pull request #2886 from jestabro/add-kernel-boot-options
system-option: T5979: Add 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