From: lombardof Date: Fri, 25 May 2018 15:48:59 +0000 (+0200) Subject: fix parser vim config without quotes X-Git-Tag: v4.0.1~2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=7ad15238a5c7b344ff84540cccc4382a8cc1b75f;p=osm%2FLW-UI.git fix parser vim config without quotes Change-Id: I7cdbd01d2445bdf966ce16a83ae057895d6601f5 Signed-off-by: lombardof --- diff --git a/vimhandler/views.py b/vimhandler/views.py index 880cf3f..78e2e67 100644 --- a/vimhandler/views.py +++ b/vimhandler/views.py @@ -18,7 +18,7 @@ from django.shortcuts import render, redirect from django.contrib.auth.decorators import login_required, permission_required from django.http import HttpResponse, JsonResponse from lib.osm.osmclient.client import Client -import json +import yaml import logging logging.basicConfig(level=logging.DEBUG) @@ -59,13 +59,12 @@ def create(request): vim_data['config'][config_key] = v if 'additional_conf' in new_vim_dict: try: - additional_conf_dict = json.loads(new_vim_dict['additional_conf']) + additional_conf_dict = yaml.safe_load(new_vim_dict['additional_conf']) for k,v in additional_conf_dict.items(): vim_data['config'][k] = v except Exception as e: # TODO return error on json.loads exception print e - result = client.vim_create(vim_data) # TODO 'vim:show', to_redirect=True, vim_id=vim_id return __response_handler(request, result, 'vim:list', to_redirect=True)