Merge "Use a status code to detect unknown vs. missing tenant"
diff --git a/zuul/scheduler.py b/zuul/scheduler.py
index 606cd04..c58bfc7 100644
--- a/zuul/scheduler.py
+++ b/zuul/scheduler.py
@@ -1153,10 +1153,15 @@
         tenant = self.abide.tenants.get(tenant_name)
         if not tenant:
             if tenant_name not in self.unparsed_abide.known_tenants:
-                return json.dumps({"message": "Unknown tenant"})
+                return json.dumps({
+                    "message": "Unknown tenant",
+                    "code": 404
+                })
             self.log.warning("Tenant %s isn't loaded" % tenant_name)
-            return json.dumps(
-                {"message": "Tenant %s isn't ready" % tenant_name})
+            return json.dumps({
+                "message": "Tenant %s isn't ready" % tenant_name,
+                "code": 204
+            })
         for pipeline in tenant.layout.pipelines.values():
             pipelines.append(pipeline.formatStatusJSON(websocket_url))
         return json.dumps(data)
diff --git a/zuul/web/__init__.py b/zuul/web/__init__.py
index 7a1af30..31eac7d 100755
--- a/zuul/web/__init__.py
+++ b/zuul/web/__init__.py
@@ -172,8 +172,8 @@
             self.cache[tenant] = json.loads(job.data[0])
             self.cache_time[tenant] = time.time()
         payload = self.cache[tenant]
-        if payload.get('message') == 'Unknown tenant':
-            return web.HTTPNotFound()
+        if payload.get('code') == 404:
+            return web.HTTPNotFound(reason=payload['message'])
         if result_filter:
             payload = result_filter.filterPayload(payload)
         resp = web.json_response(payload)