Skip to content

Commit 54d2df0

Browse files
committed
add get_features_list
1 parent 79f5b1e commit 54d2df0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/python_gardenlinux_lib/features/parse_features.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,20 @@ def get_features_dict(cname: str, gardenlinux_root: str) -> dict:
138138
if __get_node_type(graph.nodes[feature]) == type
139139
]
140140
return features_by_type
141+
142+
def get_features_list(cname: str, gardenlinux_root: str) -> list:
143+
"""
144+
:param str cname: the target cname to get the feature dict for
145+
:param str gardenlinux_root: path of garden linux src root
146+
:return: list of features for a given cname
141147
148+
"""
149+
feature_base_dir = f"{gardenlinux_root}/features"
150+
input_features = __reverse_cname_base(cname)
151+
feature_graph = read_feature_files(feature_base_dir)
152+
graph = filter_graph(feature_graph, input_features)
153+
features = __reverse_sort_nodes(graph)
154+
return features
142155

143156
def get_features(cname: str, gardenlinux_root: str) -> str:
144157
"""

0 commit comments

Comments
 (0)