File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -439,6 +439,14 @@ def get_hostname_by_unit(self, _) -> str:
439439        return  self ._unit_ip 
440440
441441    def  _on_secret_remove (self , event : SecretRemoveEvent ) ->  None :
442+         # A secret removal (entire removal, not just a revision removal) causes 
443+         # https://github.com/juju/juju/issues/20794. This check is to avoid the 
444+         # errors that would happen if we tried to remove the revision in that case 
445+         # (in the revision removal, the label is present). 
446+         if  event .secret .label  is  None :
447+             logger .debug ("Secret with no label cannot be removed" )
448+             return 
449+         logger .debug (f"Removing secret with label { event .secret .label } { event .revision }  )
442450        event .remove_revision ()
443451
444452    def  _on_get_primary (self , event : ActionEvent ) ->  None :
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments