@@ -122,23 +122,35 @@ def get_info_from_helm(component, repo, services):
122
122
log .debug (
123
123
f'Container image found in image->repository for { component_name } : { container_image } '
124
124
)
125
- if (
126
- container_image := helm_default_values .get ('generic-service' )
127
- .get ('image' )
128
- .get ('repository' )
129
- ):
130
- data ['container_image' ] = container_image
131
- log .debug (
132
- f'Container image found in generic-service->image->repository for { component_name } : { container_image } '
133
- )
125
+ if 'generic-service' in helm_default_values :
126
+ if 'generic-service' in helm_default_values and (
127
+ container_image := helm_default_values .get ('generic-service' )
128
+ .get ('image' )
129
+ .get ('repository' )
130
+ ):
131
+ data ['container_image' ] = container_image
132
+ log .debug (
133
+ f'Container image found in generic-service->image->repository for { component_name } : { container_image } '
134
+ )
135
+ # Try to get the productID
136
+ if helm_product_id := helm_default_values .get ('generic-service' , {}).get (
137
+ 'productId' , {}
138
+ ):
139
+ data ['product' ] = sc .get_id ('products' , 'p_id' , helm_product_id )
140
+ # Get modsecurity data defaults, if enabled.
141
+ for mod_security_type in [
142
+ 'modsecurity_enabled' ,
143
+ 'modsecurity_audit_enabled' ,
144
+ 'modsecurity_snippet' ,
145
+ ]:
146
+ mod_security_defaults [mod_security_type ] = (
147
+ helm_default_values .get ('generic-service' , {})
148
+ .get ('ingress' , {})
149
+ .get (mod_security_type , None )
150
+ )
134
151
if not data .get ('container_image' ):
135
152
log .info (f'No container image found for { component_name } ' )
136
153
137
- # Try to get the productID
138
- if helm_product_id := helm_default_values .get ('generic-service' , {}).get (
139
- 'productId' , {}
140
- ):
141
- data ['product' ] = sc .get_id ('products' , 'p_id' , helm_product_id )
142
154
# If the service catalogue product ID already exists (there is no reason why it shouldn't), use that instead
143
155
# TODO: use the product_id from the repository variables?
144
156
if (
@@ -149,17 +161,6 @@ def get_info_from_helm(component, repo, services):
149
161
):
150
162
data ['product' ] = sc_product_id
151
163
152
- # Get modsecurity data defaults, if enabled.
153
- for mod_security_type in [
154
- 'modsecurity_enabled' ,
155
- 'modsecurity_audit_enabled' ,
156
- 'modsecurity_snippet' ,
157
- ]:
158
- mod_security_defaults [mod_security_type ] = (
159
- helm_default_values .get ('generic-service' , {})
160
- .get ('ingress' , {})
161
- .get (mod_security_type , None )
162
- )
163
164
alert_severity_label_default = helm_default_values .get (
164
165
'generic-prometheus-alerts' , {}
165
166
).get ('alertSeverity' , None )
0 commit comments