← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~julian-edwards/maas/1.2-start-node-error-bug-1069603 into lp:maas/1.2

 

Julian Edwards has proposed merging lp:~julian-edwards/maas/1.2-start-node-error-bug-1069603 into lp:maas/1.2.

Commit message:
Prevent an unnecessary stack trace in the metadataserver log when starting a node that has no user data.

Requested reviews:
  Julian Edwards (julian-edwards)
Related bugs:
  Bug #1069603 in MAAS: "Error in log when using 'Start node' button: MAASAPINotFound: No user data available for this node."
  https://bugs.launchpad.net/maas/+bug/1069603

For more details, see:
https://code.launchpad.net/~julian-edwards/maas/1.2-start-node-error-bug-1069603/+merge/131855
-- 
https://code.launchpad.net/~julian-edwards/maas/1.2-start-node-error-bug-1069603/+merge/131855
Your team MAAS Maintainers is subscribed to branch lp:maas/1.2.
=== modified file 'src/metadataserver/api.py'
--- src/metadataserver/api.py	2012-10-04 22:02:51 +0000
+++ src/metadataserver/api.py	2012-10-29 10:48:20 +0000
@@ -18,6 +18,9 @@
     'VersionIndexHandler',
     ]
 
+import httplib
+from logging import getLogger
+
 from django.conf import settings
 from django.core.exceptions import PermissionDenied
 from django.http import HttpResponse
@@ -57,6 +60,9 @@
 from piston.utils import rc
 
 
+logger = getLogger("metadataserver")
+
+
 class UnknownMetadataVersion(MAASAPINotFound):
     """Not a known metadata version."""
 
@@ -327,7 +333,9 @@
                 NodeUserData.objects.get_user_data(node),
                 mimetype='application/octet-stream')
         except NodeUserData.DoesNotExist:
-            raise MAASAPINotFound("No user data available for this node.")
+            logger.info(
+                "No user data registered for node named %s" % node.hostname)
+            return HttpResponse(status=httplib.NOT_FOUND)
 
 
 class EnlistMetaDataHandler(OperationsHandler):


Follow ups