File tree 1 file changed +4
-10
lines changed
1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -775,28 +775,22 @@ class SmartSwitchModuleUpdater(ModuleUpdater):
775
775
776
776
def update_dpu_state (self , key , state ):
777
777
"""
778
- Update DPU state in chassisStateDB using the given key.
778
+ Update specific DPU state fields in chassisStateDB using the given key.
779
779
"""
780
780
try :
781
781
# Connect to the CHASSIS_STATE_DB using daemon_base
782
782
if not self .chassis_state_db :
783
783
self .chassis_state_db = daemon_base .db_connect ("CHASSIS_STATE_DB" )
784
784
785
- # Fetch the current data for the given key and convert it to a dict
786
- current_data = self ._convert_to_dict (self .chassis_state_db .hgetall (key ))
787
-
788
- if current_data :
789
- self .chassis_state_db .delete (key )
790
-
791
- # Prepare the updated data
785
+ # Prepare the fields to update
792
786
updates = {
793
787
"dpu_midplane_link_state" : state ,
794
788
"dpu_midplane_link_reason" : "" ,
795
789
"dpu_midplane_link_time" : get_formatted_time (),
796
790
}
797
- current_data .update (updates )
798
791
799
- for field , value in current_data .items ():
792
+ # Update each field directly
793
+ for field , value in updates .items ():
800
794
self .chassis_state_db .hset (key , field , value )
801
795
802
796
except Exception as e :
You can’t perform that action at this time.
0 commit comments