← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/maas/no-public-keys-is-not-an-error into lp:maas

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/no-public-keys-is-not-an-error into lp:maas.

Commit message:
If a node requests its public-keys but there are none, just return a success response without any keys.  The tracebacks were distracting, and may or may not have affected commissioning.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1058313 in MAAS: "MAASAPINotFound: Unknown metadata attribute: public-keys  during commissioning"
  https://bugs.launchpad.net/maas/+bug/1058313

For more details, see:
https://code.launchpad.net/~jtv/maas/no-public-keys-is-not-an-error/+merge/127969

Julian ran into the traceback when commissioning.  Commissioning was broken for apparently unrelated reasons, but we might as well eliminate the error from our list of suspects.


Jeroen
-- 
https://code.launchpad.net/~jtv/maas/no-public-keys-is-not-an-error/+merge/127969
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/no-public-keys-is-not-an-error into lp:maas.
=== modified file 'src/metadataserver/api.py'
--- src/metadataserver/api.py	2012-10-04 00:01:47 +0000
+++ src/metadataserver/api.py	2012-10-04 09:45:30 +0000
@@ -339,7 +339,10 @@
         """ Produce public-keys attribute."""
         keys = SSHKey.objects.get_keys_for_user(user=node.owner)
         if not keys:
-            raise MAASAPINotFound("No registered public keys")
+            # We get requests for this from cloud-init, regardless of
+            # whether any keys are available.  Return 404, but don't
+            # raise an exception that would cause unnecessary log noise.
+            return HttpResponseNotFound("No registered public keys")
         return make_list_response(keys)
 
 


Follow ups