summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-25 12:28:04 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-25 12:28:04 -0700
commitffe4cde6d3fd95131b4434ca2d88af469dacfd51 (patch)
tree83f1ffb033d78a0e93605769478ebb9b9e3cc2aa /tools
parent894e21ebf1bff470b34f94b9f3e552e316b22a1f (diff)
downloadvyos-cloud-init-ffe4cde6d3fd95131b4434ca2d88af469dacfd51.tar.gz
vyos-cloud-init-ffe4cde6d3fd95131b4434ca2d88af469dacfd51.zip
Add warning when hitting a unknown api.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/mock-meta.py13
1 files changed, 10 insertions, 3 deletions
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):