From 14ec28790229871653afbf2a4c9f1f4e3fb637f5 Mon Sep 17 00:00:00 2001 From: Kiall Mac Innes Date: Tue, 11 Dec 2012 07:12:10 -0800 Subject: [PATCH] Ensure partial API updates are validated correctly Change-Id: Id8123a780131989e5a0f36da478c3d34e21db209 --- moniker/api/v1/domains.py | 5 ++++- moniker/api/v1/records.py | 5 ++++- moniker/api/v1/servers.py | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/moniker/api/v1/domains.py b/moniker/api/v1/domains.py index f617809b4..a51f2e20c 100644 --- a/moniker/api/v1/domains.py +++ b/moniker/api/v1/domains.py @@ -98,7 +98,10 @@ def update_domain(domain_id): values = flask.request.json try: - domain_schema.validate(values) + domain = central_api.get_domain(context, domain_id) + domain.update(values) + + domain_schema.validate(domain) domain = central_api.update_domain(context, domain_id, values) except exceptions.Forbidden: return flask.Response(status=401) diff --git a/moniker/api/v1/records.py b/moniker/api/v1/records.py index 1bd759a0e..597c4394a 100644 --- a/moniker/api/v1/records.py +++ b/moniker/api/v1/records.py @@ -98,7 +98,10 @@ def update_record(domain_id, record_id): values = flask.request.json try: - record_schema.validate(values) + record = central_api.get_record(context, domain_id, record_id) + record.update(values) + + record_schema.validate(record) record = central_api.update_record(context, domain_id, record_id, values) except exceptions.Forbidden: diff --git a/moniker/api/v1/servers.py b/moniker/api/v1/servers.py index 98377c0ca..d23364cd5 100644 --- a/moniker/api/v1/servers.py +++ b/moniker/api/v1/servers.py @@ -97,7 +97,10 @@ def update_server(server_id): values = flask.request.json try: - server_schema.validate(values) + server = central_api.get_server(context, server_id) + server.update(values) + + server_schema.validate(server) server = central_api.update_server(context, server_id, values=values) except exceptions.Forbidden: return flask.Response(status=401)