25
25
26
26
27
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
28
+ return resource .exported and (
29
+ ('only-cross-site' not in resource .tags and 'no-cross-site' not in resource .tags ) or
30
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' ))
31
+ ('only-cross-site' not in resource .tags and 'no-cross-site' in resource .tags and localsite == 'true' )
32
+ )
32
33
33
34
34
35
def render_resources (database , resource_type , localsite , template_names ):
@@ -70,7 +71,7 @@ def render_resources(database, resource_type, localsite, template_names):
70
71
nameparts = name .split ('_' )
71
72
if nameparts [0 ].lower () == object_name and name not in envs_to_ignore :
72
73
dto ['parameters' ].append ({'_' .join (nameparts [1 :]).lower (): os .environ [name ].lower ()})
73
- icinga_config += template .render (dto = dto ) + ' \n '
74
+ icinga_config += template .render (dto = dto )
74
75
# collect child service dependencies under parent service_description
75
76
for tag in resource .tags :
76
77
if 'parent:' in tag :
@@ -86,7 +87,7 @@ def render_resources(database, resource_type, localsite, template_names):
86
87
parent_service_description = item .replace ('_' , ' ' )
87
88
# lookup parent resource by its service_description
88
89
for parent in resources :
89
- if is_resource_visible (resource , localsite ):
90
+ if is_resource_visible (parent , localsite ):
90
91
for key , value in parent .parameters .items ():
91
92
if key == 'service_description' and parent_service_description in value .lower ():
92
93
for child in service_dependencies [item ]:
@@ -98,7 +99,7 @@ def render_resources(database, resource_type, localsite, template_names):
98
99
'dependent_host_name' : child .parameters ['host_name' ],
99
100
'dependent_service_description' : child .parameters ['service_description' ]
100
101
}]
101
- icinga_config += template .render (dto = dto ) + ' \n '
102
+ icinga_config += template .render (dto = dto )
102
103
return icinga_config
103
104
104
105
0 commit comments