@@ -174,14 +174,13 @@ def __init__(
174174 def check_body_fields (self ) -> None :
175175 required_params = ["machine_type" , "disks" , "network_interfaces" ]
176176 for param in required_params :
177- if param in self .body :
178- continue
179- readable_param = param .replace ("_" , " " )
180- raise AirflowException (
181- f"The body '{ self .body } ' should contain at least { readable_param } for the new operator "
182- f"in the '{ param } ' field. Check (google.cloud.compute_v1.types.Instance) "
183- f"for more details about body fields description."
184- )
177+ if param not in self .body :
178+ readable_param = param .replace ("_" , " " )
179+ raise AirflowException (
180+ f"The body '{ self .body } ' should contain at least { readable_param } for the new operator "
181+ f"in the '{ param } ' field. Check (google.cloud.compute_v1.types.Instance) "
182+ f"for more details about body fields description."
183+ )
185184
186185 def _validate_inputs (self ) -> None :
187186 super ()._validate_inputs ()
@@ -915,14 +914,13 @@ def __init__(
915914 def check_body_fields (self ) -> None :
916915 required_params = ["machine_type" , "disks" , "network_interfaces" ]
917916 for param in required_params :
918- if param in self .body ["properties" ]:
919- continue
920- readable_param = param .replace ("_" , " " )
921- raise AirflowException (
922- f"The body '{ self .body } ' should contain at least { readable_param } for the new operator "
923- f"in the '{ param } ' field. Check (google.cloud.compute_v1.types.Instance) "
924- f"for more details about body fields description."
925- )
917+ if param not in self .body ["properties" ]:
918+ readable_param = param .replace ("_" , " " )
919+ raise AirflowException (
920+ f"The body '{ self .body } ' should contain at least { readable_param } for the new operator "
921+ f"in the '{ param } ' field. Check (google.cloud.compute_v1.types.Instance) "
922+ f"for more details about body fields description."
923+ )
926924
927925 def _validate_all_body_fields (self ) -> None :
928926 if self ._field_validator :
@@ -1500,14 +1498,13 @@ def __init__(
15001498 def check_body_fields (self ) -> None :
15011499 required_params = ["base_instance_name" , "target_size" , "instance_template" ]
15021500 for param in required_params :
1503- if param in self .body :
1504- continue
1505- readable_param = param .replace ("_" , " " )
1506- raise AirflowException (
1507- f"The body '{ self .body } ' should contain at least { readable_param } for the new operator "
1508- f"in the '{ param } ' field. Check (google.cloud.compute_v1.types.Instance) "
1509- f"for more details about body fields description."
1510- )
1501+ if param not in self .body :
1502+ readable_param = param .replace ("_" , " " )
1503+ raise AirflowException (
1504+ f"The body '{ self .body } ' should contain at least { readable_param } for the new operator "
1505+ f"in the '{ param } ' field. Check (google.cloud.compute_v1.types.Instance) "
1506+ f"for more details about body fields description."
1507+ )
15111508
15121509 def _validate_all_body_fields (self ) -> None :
15131510 if self ._field_validator :
0 commit comments