From 6acc0482dda8db0c6c4fe4a2d9df837c09771854 Mon Sep 17 00:00:00 2001 From: Gonza Rafuls Date: Wed, 18 Nov 2020 16:43:31 +0100 Subject: [PATCH] fix: vlan id for cloud history we were not storing the vlan id on cloud history Change-Id: I53b83ca566fc13d092279673f6190fe510406c8e --- quads/model.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/quads/model.py b/quads/model.py index aa2a8eb8e..d9d170973 100644 --- a/quads/model.py +++ b/quads/model.py @@ -81,10 +81,17 @@ class CloudHistory(Document): @staticmethod def prep_data(data): - for flag in ['provisioned', 'validated', 'vlan', 'last_redefined']: + for flag in ['provisioned', 'validated', 'last_redefined']: if flag in data: data.pop(flag) + if 'vlan' in data: + if type(data.get('vlan')) == str: + data['vlan_id'] = int(data.get('vlan')) + elif type(data.get('vlan')) == Vlan: + data['vlan_id'] = data.get('vlan').vlan_id + data.pop('vlan') + params = ['name', 'description', 'owner', 'ticket'] result, data = param_check(data, params)