From 4a6ae51eab09c1c38a52404fe816baad1c67376d Mon Sep 17 00:00:00 2001 From: gongysh Date: Tue, 4 Dec 2012 14:46:25 +0800 Subject: [PATCH] Support to reset dnsname_servers and host_routes to empty Bug #1086232 Change-Id: Ia27170b206f755577c8607c5b27dc5cf57d19633 --- quantum/api/v2/attributes.py | 7 ++++ quantum/tests/unit/metaplugin/test_basic.py | 6 ++++ quantum/tests/unit/test_attributes.py | 10 ++++++ quantum/tests/unit/test_db_plugin.py | 36 ++++++++++++++++++--- 4 files changed, 55 insertions(+), 4 deletions(-) diff --git a/quantum/api/v2/attributes.py b/quantum/api/v2/attributes.py index 203f0d54d..8cda1eee5 100644 --- a/quantum/api/v2/attributes.py +++ b/quantum/api/v2/attributes.py @@ -289,6 +289,11 @@ def convert_kvp_list_to_dict(kvp_list): kvp_map[key].add(value) return dict((x, list(y)) for x, y in kvp_map.iteritems()) + +def convert_none_to_empty_list(value): + return [] if value is None else value + + HOSTNAME_PATTERN = ("(?=^.{1,254}$)(^(?:(?!\d+\.|-)[a-zA-Z0-9_\-]" "{1,63}(?