From ffe4cde6d3fd95131b4434ca2d88af469dacfd51 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Mon, 25 Jun 2012 12:28:04 -0700 Subject: Add warning when hitting a unknown api. --- tools/mock-meta.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/mock-meta.py b/tools/mock-meta.py index d4677af6..0f13acd6 100755 --- a/tools/mock-meta.py +++ b/tools/mock-meta.py @@ -6,10 +6,11 @@ import functools import httplib +import json import logging -import sys -import string import random +import string +import sys import yaml from optparse import OptionParser @@ -88,6 +89,8 @@ PLACEMENT_CAPABILITIES = { 'availability-zone': AVAILABILITY_ZONES, } +NOT_IMPL_RESPONSE = json.dumps({}) + class WebException(Exception): def __init__(self, code, msg): @@ -181,7 +184,11 @@ class MetaDataHandler(object): else: return "%s" % (PLACEMENT_CAPABILITIES.get(pentry, '')) else: - return '{}' + log.warn(("Did not implement action %s, " + "returning empty response: %r"), + action, NOT_IMPL_RESPONSE) + return NOT_IMPL_RESPONSE + class UserDataHandler(object): -- cgit v1.2.3