Platform interface no longer requires networks

This commit prevents the interface class from being set to None
once all the networks have been removed from the platform
interface. The interface class will remain to be platform
until changed.

Closes-Bug: 1793779

Change-Id: Ie1ec201fa0f953831a83077244b452bb0dbd0791
Signed-off-by: Patrick Bonnell <patrick.bonnell@windriver.com>
This commit is contained in:
Patrick Bonnell 2018-09-21 10:24:53 -04:00
parent 9adb952ffe
commit 29637dcf6e
1 changed files with 0 additions and 6 deletions

View File

@ -484,16 +484,10 @@ class AddInterface(forms.SelfHandlingForm):
def clean(self):
cleaned_data = super(AddInterface, self).clean()
ifclass = cleaned_data.get('ifclass', 'none')
networks = cleaned_data.get('networks', [])
if ifclass != 'platform':
cleaned_data['networks'] = []
if ifclass == 'platform' and not networks:
raise forms.ValidationError(_(
"You must assign a network when "
"creating a platform interface."))
if ifclass != 'data':
cleaned_data.pop('ipv4_mode', None)
cleaned_data.pop('ipv6_mode', None)