-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4015 from jestabro/configdep-prio
T6671: defer config dependency if scheduled in priority queue
- Loading branch information
Showing
7 changed files
with
180 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2023 VyOS maintainers and contributors <[email protected]> | ||
# Copyright 2024 VyOS maintainers and contributors <[email protected]> | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
|
@@ -54,8 +54,8 @@ def is_valueless(path: list) -> bool: | |
def is_leaf(path: list) -> bool: | ||
return load_reference().is_leaf(path) | ||
|
||
def owner(path: list) -> str: | ||
return load_reference().owner(path) | ||
def owner(path: list, with_tag=False) -> str: | ||
return load_reference().owner(path, with_tag=with_tag) | ||
|
||
def priority(path: list) -> str: | ||
return load_reference().priority(path) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2023 VyOS maintainers and contributors <[email protected]> | ||
# Copyright 2024 VyOS maintainers and contributors <[email protected]> | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
|
@@ -139,28 +139,38 @@ def _least_upper_data(self, path: list, name: str) -> str: | |
ref_path = path.copy() | ||
d = self.ref | ||
data = '' | ||
tag = '' | ||
while ref_path and d: | ||
tag_val = '' | ||
d = d.get(ref_path[0], {}) | ||
ref_path.pop(0) | ||
if self._is_tag_node(d) and ref_path: | ||
tag_val = ref_path[0] | ||
ref_path.pop(0) | ||
if self._is_leaf_node(d) and ref_path: | ||
ref_path.pop(0) | ||
res = self._get_ref_node_data(d, name) | ||
if res is not None: | ||
data = res | ||
tag = tag_val | ||
|
||
return data | ||
return data, tag | ||
|
||
def owner(self, path: list) -> str: | ||
def owner(self, path: list, with_tag=False) -> str: | ||
from pathlib import Path | ||
data = self._least_upper_data(path, 'owner') | ||
data, tag = self._least_upper_data(path, 'owner') | ||
tag_ext = f'_{tag}' if tag else '' | ||
if data: | ||
data = Path(data.split()[0]).name | ||
if with_tag: | ||
data = Path(data.split()[0]).stem | ||
data = f'{data}{tag_ext}' | ||
else: | ||
data = Path(data.split()[0]).name | ||
return data | ||
|
||
def priority(self, path: list) -> str: | ||
return self._least_upper_data(path, 'priority') | ||
data, _ = self._least_upper_data(path, 'priority') | ||
return data | ||
|
||
@staticmethod | ||
def _dict_get(d: dict, path: list) -> dict: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters