From 7ad15238a5c7b344ff84540cccc4382a8cc1b75f Mon Sep 17 00:00:00 2001 From: lombardof Date: Fri, 25 May 2018 17:48:59 +0200 Subject: [PATCH] fix parser vim config without quotes Change-Id: I7cdbd01d2445bdf966ce16a83ae057895d6601f5 Signed-off-by: lombardof --- vimhandler/views.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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) -- 2.25.1