forked from infra/otc-metadata
Add environment filter to services_by_category
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-authored-by: Gode, Sebastian <sebastian.gode@t-systems.com> Co-committed-by: Gode, Sebastian <sebastian.gode@t-systems.com>
This commit is contained in:
parent
663cfbed75
commit
f217cafb1b
@ -87,10 +87,13 @@ class Services(object):
|
|||||||
res.append(copy.deepcopy(cat))
|
res.append(copy.deepcopy(cat))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def services_by_category(self, category):
|
def services_by_category(self, category, environment=None):
|
||||||
"""List services matching category"""
|
"""List services matching category"""
|
||||||
res = []
|
res = []
|
||||||
for srv in self.all_services:
|
for srv in self.all_services:
|
||||||
|
if environment:
|
||||||
|
if "environment" in srv and srv["environment"] != environment:
|
||||||
|
continue
|
||||||
if srv["service_category"] == category:
|
if srv["service_category"] == category:
|
||||||
res.append(copy.deepcopy(srv))
|
res.append(copy.deepcopy(srv))
|
||||||
return res
|
return res
|
||||||
|
Loading…
x
Reference in New Issue
Block a user