@@ -239,7 +239,7 @@ def main():
239239 name = dict (type = "str" ),
240240 uuid = dict (type = "str" ),
241241 description = dict (type = "str" ),
242- netflow_record = dict (type = "dict" , ** ndo_template_object_spec_with_uuid (required_uuid_and_reference = False )),
242+ netflow_record = dict (type = "dict" , ** ndo_template_object_spec_with_uuid (required_uuid_or_reference = False )),
243243 netflow_exporters = dict (type = "list" , elements = "dict" , ** ndo_template_object_spec_with_uuid ()),
244244 state = dict (type = "str" , default = "query" , choices = ["absent" , "query" , "present" ]),
245245 )
@@ -298,8 +298,7 @@ def main():
298298 netflow_monitor_object = copy .deepcopy (match .details )
299299 netflow_monitor_object ["exporterRefs" ] = netflow_exporters_list_to_dict (netflow_monitor_object .get ("exporterRefs" ))
300300 updated_netflow_monitor_object = mso_template .update_config_with_template_and_references (netflow_monitor_object , reference_details , False )
301- mso .previous = copy .deepcopy (updated_netflow_monitor_object )
302- mso .existing = copy .deepcopy (updated_netflow_monitor_object )
301+ mso .previous = mso .existing = copy .deepcopy (updated_netflow_monitor_object )
303302 elif match : # Query all objects
304303 for obj in match :
305304 obj ["exporterRefs" ] = netflow_exporters_list_to_dict (obj .get ("exporterRefs" ))
@@ -347,6 +346,9 @@ def main():
347346 if not netflow_exporter_uuids :
348347 mso_values .pop ("exporterRefs" , None )
349348
349+ if netflow_record is None and netflow_record_uuid is None :
350+ mso_values .pop ("recordRef" , None )
351+
350352 append_update_ops_data (ops , match .details , path , mso_values )
351353 mso .sanitize (mso_values , collate = True )
352354 else :
@@ -357,8 +359,6 @@ def main():
357359 ops .append (dict (op = "remove" , path = path ))
358360
359361 if mso .proposed :
360- mso .proposed = copy .deepcopy (mso .proposed )
361-
362362 if (
363363 mso .proposed .get ("exporterRefs" )
364364 and isinstance (mso .proposed .get ("exporterRefs" ), list )
0 commit comments