vlans: save port immediately after setting mode
Otherwise VLANs can’t be set.
This commit is contained in:
		
							parent
							
								
									540e39bc9d
								
							
						
					
					
						commit
						cbd930f76f
					
				
					 1 changed files with 3 additions and 0 deletions
				
			
		
							
								
								
									
										3
									
								
								vlans.py
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								vlans.py
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -135,14 +135,17 @@ class SetVLANScript(Script):
 | 
			
		|||
            match len(data['vlans']):
 | 
			
		||||
                case 0:
 | 
			
		||||
                    port.mode = 'access'
 | 
			
		||||
                    port.save()
 | 
			
		||||
                    port.tagged_vlans.clear()
 | 
			
		||||
                    port.untagged_vlan = None
 | 
			
		||||
                case 1:
 | 
			
		||||
                    port.mode = 'access'
 | 
			
		||||
                    port.save()
 | 
			
		||||
                    port.tagged_vlans.clear()
 | 
			
		||||
                    port.untagged_vlan = data['vlans'][0]
 | 
			
		||||
                case _:
 | 
			
		||||
                    port.mode = 'tagged'
 | 
			
		||||
                    port.save()
 | 
			
		||||
                    port.tagged_vlans.set(data['vlans'])
 | 
			
		||||
                    port.untagged_vlan = None
 | 
			
		||||
            port.full_clean()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue