File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -362,7 +362,7 @@ def system_allowed_in_ros(msg, reporter):
362362 msg .get ('type' ) == 'updated'
363363 and is_platform_metadata_check_pass (msg )
364364 ):
365- return is_valid_cloud_provider (cloud_provider )
365+ return is_valid_cloud_provider (cloud_provider ) and is_valid_operating_system ( operating_system )
366366 is_ros = msg ["platform_metadata" ].get ("is_ros" )
367367 return validate_ros_payload (is_ros , cloud_provider , operating_system )
368368
Original file line number Diff line number Diff line change @@ -149,16 +149,22 @@ def process_system_details(self, msg):
149149 host = msg ['host' ]
150150 with app .app_context ():
151151 # 'platform_metadata' field not included when the host is updated via the API.
152- if (msg .get ('type' ) == 'updated' and is_platform_metadata_check_pass ( msg ) ):
152+ if (msg .get ('type' ) == 'updated' ):
153153 system_fields = {
154154 "inventory_id" : host ['id' ],
155155 "display_name" : host ['display_name' ],
156156 "fqdn" : host ['fqdn' ],
157- "cloud_provider" : host ['system_profile' ]['cloud_provider' ],
158157 "stale_timestamp" : host ['stale_timestamp' ],
159- "operating_system" : host ['system_profile' ].get ('operating_system' ),
160158 "groups" : host .get ('groups' , [])
161159 }
160+
161+ operating_system = host ['system_profile' ].get ('operating_system' )
162+ cloud_provider = host ['system_profile' ].get ('cloud_provider' )
163+ if (operating_system is not None ):
164+ system_fields .update ({"operating_system" : operating_system })
165+ if (cloud_provider is not None ):
166+ system_fields .update ({"cloud_provider" : cloud_provider })
167+
162168 system = update_system_record (db .session , ** system_fields )
163169 if system is not None :
164170 db .session .commit ()
You can’t perform that action at this time.
0 commit comments