storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject [1/4] storm git commit: made change to logviewer.clj in order to remove the invalid 500 http response instead of 404
Date Thu, 16 Jul 2015 17:54:30 GMT
Repository: storm
Updated Branches:
  refs/heads/master 77f0c8b5b -> 3bc60817d


made change to logviewer.clj in order to remove the invalid 500 http response instead of 404


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/6778b567
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/6778b567
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/6778b567

Branch: refs/heads/master
Commit: 6778b567b56b77a1ac0afe223305865b8684d199
Parents: 9906f85
Author: Sanket <schintap@untilservice-lm>
Authored: Wed Jul 15 09:10:37 2015 -0500
Committer: Sanket <schintap@untilservice-lm>
Committed: Wed Jul 15 09:10:37 2015 -0500

----------------------------------------------------------------------
 .../src/clj/backtype/storm/daemon/logviewer.clj | 26 ++++++++++++--------
 1 file changed, 16 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/6778b567/storm-core/src/clj/backtype/storm/daemon/logviewer.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/daemon/logviewer.clj b/storm-core/src/clj/backtype/storm/daemon/logviewer.clj
index e77527b..fabd213 100644
--- a/storm-core/src/clj/backtype/storm/daemon/logviewer.clj
+++ b/storm-core/src/clj/backtype/storm/daemon/logviewer.clj
@@ -181,12 +181,15 @@
 
 (defn get-log-user-group-whitelist [fname]
   (let [wl-file (get-log-metadata-file fname)
-        m (clojure-from-yaml-file wl-file)
-        user-wl (.get m LOGS-USERS)
-        user-wl (if user-wl user-wl [])
-        group-wl (.get m LOGS-GROUPS)
-        group-wl (if group-wl group-wl [])]
-    [user-wl group-wl]))
+        m (clojure-from-yaml-file wl-file)]
+    (if (not-nil? m)
+      (do
+        (let [user-wl (.get m LOGS-USERS)
+              user-wl (if user-wl user-wl [])
+              group-wl (.get m LOGS-GROUPS)
+              group-wl (if group-wl group-wl [])]
+          [user-wl group-wl]))
+        nil)))
 
 (def igroup-mapper (AuthUtils/GetGroupMappingServiceProviderPlugin *STORM-CONF*))
 (defn user-groups
@@ -194,7 +197,7 @@
   (if (blank? user) [] (.getGroups igroup-mapper user)))
 
 (defn authorized-log-user? [user fname conf]
-  (if (or (blank? user) (blank? fname))
+  (if (or (blank? user) (blank? fname) (nil? (get-log-user-group-whitelist fname)))
     nil
     (let [groups (user-groups user)
           [user-wl group-wl] (get-log-user-group-whitelist fname)
@@ -220,7 +223,7 @@ Note that if anything goes wrong, this will throw an Error and exit."
 (defnk to-btn-link
   "Create a link that is formatted like a button"
   [url text :enabled true]
-  [:a {:href (java.net.URI. url) 
+  [:a {:href (java.net.URI. url)
        :class (str "btn btn-default " (if enabled "enabled" "disabled"))} text])
 
 (defn pager-links [fname start length file-size]
@@ -248,7 +251,7 @@ Note that if anything goes wrong, this will throw an Error and exit."
                            :start (min (max 0 (- file-size length))
                                        (+ start length))
                            :length length})
-                        "Next" :enabled (> next-start start))])]])) 
+                        "Next" :enabled (> next-start start))])]]))
 
 (defn- download-link [fname]
   [[:p (link-to (url-format "/download/%s" fname) "Download Full Log")]])
@@ -285,7 +288,10 @@ Note that if anything goes wrong, this will throw an Error and exit."
                             pager-data)))))
         (-> (resp/response "Page not found")
             (resp/status 404))))
-    (unauthorized-user-html user)))
+    (if (nil? (get-log-user-group-whitelist fname))
+      (-> (resp/response "Page not found")
+        (resp/status 404))
+      (unauthorized-user-html user)))
 
 (defn download-log-file [fname req resp user ^String root-dir]
   (let [file (.getCanonicalFile (File. root-dir fname))]


Mime
View raw message