24
24
ENVIRONMENT = jinja2 .Environment (trim_blocks = True , lstrip_blocks = True , loader = LOADER , extensions = EXTENSIONS )
25
25
26
26
27
+ def is_resource_visible (resource , localsite ):
28
+ return resource .exported and
29
+ (('only-cross-site' not in resource .tags and 'no-cross-site' not in resource .tags ) or
30
+ ('only-cross-site' in resource .tags and 'no-cross-site' not in resource .tags and localsite == 'false' ) or
31
+ ('only-cross-site' not in resource .tags and 'no-cross-site' in resource .tags and localsite == 'true' ))
32
+
33
+
27
34
def render_resources (database , resource_type , localsite , template_names ):
28
35
"""
29
36
Render resources of the given type. They are queried from the given
@@ -45,7 +52,7 @@ def render_resources(database, resource_type, localsite, template_names):
45
52
for resource in r :
46
53
resources .append (resource )
47
54
envs_to_ignore = []
48
- if resource . exported and ( 'only-cross-site' not in resource . tags or localsite == 'false' ):
55
+ if is_resource_visible ( resource , localsite ):
49
56
dto = {}
50
57
dto ['object_name' ] = object_name
51
58
dto ['named_object' ] = named_object
@@ -79,7 +86,7 @@ def render_resources(database, resource_type, localsite, template_names):
79
86
parent_service_description = item .replace ('_' , ' ' )
80
87
# lookup parent resource by its service_description
81
88
for parent in resources :
82
- if parent . exported and ( 'only-cross-site' not in parent . tags or localsite == 'false' ):
89
+ if is_resource_visible ( resource , localsite ):
83
90
for key , value in parent .parameters .items ():
84
91
if key == 'service_description' and parent_service_description in value .lower ():
85
92
for child in service_dependencies [item ]:
0 commit comments