summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-12-18 15:32:14 -0600
committerJohn Estabrook <jestabro@vyos.io>2024-04-28 09:21:08 -0500
commitc5e6f9aef770e17fbc32df948d8461e41337de1b (patch)
treef66a6697f31bb17f930b792b0b108f421631758b
parentf980f8b8010a9681c387d47c476254c89b0c4a25 (diff)
downloadvyos-1x-c5e6f9aef770e17fbc32df948d8461e41337de1b.tar.gz
vyos-1x-c5e6f9aef770e17fbc32df948d8461e41337de1b.zip
configdep: T5836: add boolean check whether script called as dependency
(cherry picked from commit 80077eee89e4f0aa3af5dca1a4b2b5e1665bda6f)
-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):