mirror of https://github.com/h44z/wg-portal.git
				
				
				
			
							parent
							
								
									9884d8c002
								
							
						
					
					
						commit
						99df4ca3cd
					
				|  | @ -225,6 +225,15 @@ func (m Manager) RestoreInterfaceState( | ||||||
| 		if err != nil && !iface.IsDisabled() { | 		if err != nil && !iface.IsDisabled() { | ||||||
| 			slog.Debug("creating missing interface", "interface", iface.Identifier) | 			slog.Debug("creating missing interface", "interface", iface.Identifier) | ||||||
| 
 | 
 | ||||||
|  | 			// temporarily disable interface in database so that the current state is reflected correctly
 | ||||||
|  | 			_ = m.db.SaveInterface(ctx, iface.Identifier, | ||||||
|  | 				func(in *domain.Interface) (*domain.Interface, error) { | ||||||
|  | 					now := time.Now() | ||||||
|  | 					in.Disabled = &now // set
 | ||||||
|  | 					in.DisabledReason = domain.DisabledReasonInterfaceMissing | ||||||
|  | 					return in, nil | ||||||
|  | 				}) | ||||||
|  | 
 | ||||||
| 			// try to create a new interface
 | 			// try to create a new interface
 | ||||||
| 			_, err = m.saveInterface(ctx, &iface) | 			_, err = m.saveInterface(ctx, &iface) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue