@@ -166,7 +166,7 @@ def validate_field_operation(self, old_config, target_config):
166
166
if any (op ['op' ] == operation and field == op ['path' ] for op in patch ):
167
167
raise IllegalPatchOperationError ("Given patch operation is invalid. Operation: {} is illegal on field: {}" .format (operation , field ))
168
168
169
- def _invoke_validating_function (cmd ):
169
+ def _invoke_validating_function (cmd , path , operation ):
170
170
# cmd is in the format as <package/module name>.<method name>
171
171
method_name = cmd .split ("." )[- 1 ]
172
172
module_name = "." .join (cmd .split ("." )[0 :- 1 ])
@@ -184,6 +184,7 @@ def _invoke_validating_function(cmd):
184
184
185
185
for element in patch :
186
186
path = element ["path" ]
187
+ operation = element ["op" ]
187
188
match = re .search (r'\/([^\/]+)(\/|$)' , path ) # This matches the table name in the path, eg if path if /PFC_WD/GLOBAL, the match would be PFC_WD
188
189
if match is not None :
189
190
table = match .group (1 )
@@ -194,7 +195,7 @@ def _invoke_validating_function(cmd):
194
195
validating_functions .update (tables .get (table , {}).get ("field_operation_validators" , []))
195
196
196
197
for function in validating_functions :
197
- if not _invoke_validating_function (function ):
198
+ if not _invoke_validating_function (function , path , operation ):
198
199
raise IllegalPatchOperationError ("Modification of {} table is illegal- validating function {} returned False" .format (table , function ))
199
200
200
201
0 commit comments