summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-12-19 07:05:09 +0100
committerGitHub <noreply@github.com>2023-12-19 07:05:09 +0100
commit36adc467268433e1043f36001866442cd0937c4e (patch)
tree5caa5ae702918f68539567f398922a41cbe64d3c
parentf2cd94167433903b803157fefba1ee9e00312f3b (diff)
parent80077eee89e4f0aa3af5dca1a4b2b5e1665bda6f (diff)
downloadvyos-1x-36adc467268433e1043f36001866442cd0937c4e.tar.gz
vyos-1x-36adc467268433e1043f36001866442cd0937c4e.zip
Merge pull request #2655 from jestabro/called_as_dependent
configdep: T5836: add boolean check whether script called as dependency
-rw-r--r--python/vyos/configdep.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/python/vyos/configdep.py b/python/vyos/configdep.py
index 8a28811eb..64727d355 100644
--- a/python/vyos/configdep.py
+++ b/python/vyos/configdep.py
@@ -107,6 +107,13 @@ def call_dependents():
f = l.pop(0)
f()
+def called_as_dependent() -> bool:
+ st = stack()[1:]
+ for f in st:
+ if f.filename == __file__:
+ return True
+ return False
+
def graph_from_dependency_dict(d: dict) -> dict:
g = {}
for k in list(d):