[ARVADOS] created: 1.1.3-337-g6171961

Git user git at public.curoverse.com
Mon Apr 9 17:29:06 EDT 2018


        at  6171961498800d18e826da1dcb1b908600eec0ac (commit)


commit 6171961498800d18e826da1dcb1b908600eec0ac
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Thu Apr 5 16:04:28 2018 -0300

    13105: Set remoteHosts and remoteHostsViaDNS default values when missing.
    
    Also fix some discovery doc requests to use the SessionDB cache.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/apps/workbench/app/assets/javascripts/models/session_db.js b/apps/workbench/app/assets/javascripts/models/session_db.js
index fab8fe3..43aac01 100644
--- a/apps/workbench/app/assets/javascripts/models/session_db.js
+++ b/apps/workbench/app/assets/javascripts/models/session_db.js
@@ -68,7 +68,7 @@ window.SessionDB = function() {
                 url = 'https://' + url;
             }
             url = new URL(url);
-            return m.request(url.origin + '/discovery/v1/apis/arvados/v1/rest').then(function() {
+            return db.discoveryDoc({baseURL: url.origin}).map(function() {
                 return url.origin + '/';
             }).catch(function(err) {
                 // If url is a Workbench site (and isn't too old),
@@ -94,9 +94,9 @@ window.SessionDB = function() {
             }
             var session = db.loadLocal();
             var apiHostname = new URL(session.baseURL).hostname;
-            m.request(session.baseURL+'discovery/v1/apis/arvados/v1/rest').then(function(localDD) {
+            db.discoveryDoc({baseURL: session.baseURL}).map(function(localDD) {
                 var uuidPrefix = localDD.uuidPrefix;
-                m.request(baseURL+'discovery/v1/apis/arvados/v1/rest').then(function(dd) {
+                db.discoveryDoc({baseURL: baseURL}).map(function(dd) {
                     if (uuidPrefix in dd.remoteHosts ||
                         (dd.remoteHostsViaDNS && apiHostname.endsWith('.arvadosapi.com'))) {
                         // Federated identity login via salted token
@@ -233,7 +233,16 @@ window.SessionDB = function() {
             var cache = db.discoveryCache[session.baseURL];
             if (!cache) {
                 db.discoveryCache[session.baseURL] = cache = m.stream();
-                m.request(session.baseURL+'discovery/v1/apis/arvados/v1/rest').then(cache);
+                m.request(session.baseURL+'discovery/v1/apis/arvados/v1/rest')
+                    .then(function (dd) {
+                        // Just in case we're talking with an old API server.
+                        dd.remoteHosts = dd.remoteHosts || {};
+                        if (dd.remoteHostsViaDNS === undefined) {
+                            dd.remoteHostsViaDNS = false;
+                        }
+                        return dd;
+                    })
+                    .then(cache);
             }
             return cache;
         },
@@ -308,8 +317,7 @@ window.SessionDB = function() {
             if (userUUIDPrefix === session.user.owner_uuid.slice(0, 5)) {
                 return;
             }
-            var doc = db.discoveryDoc(session);
-            doc.map(function(d) {
+            db.discoveryDoc(session).map(function (d) {
                 // Guess the remote host from the local discovery doc settings
                 var rHost = null;
                 if (d.remoteHosts[userUUIDPrefix]) {
@@ -323,8 +331,7 @@ window.SessionDB = function() {
                 }
                 // Get the remote cluster workbench url & redirect there.
                 db.findAPI(rHost).then(function (apiUrl) {
-                    var doc = db.discoveryDoc({baseURL: apiUrl});
-                    doc.map(function (d) {
+                    db.discoveryDoc({baseURL: apiUrl}).map(function (d) {
                         document.location = d.workbenchUrl + path;
                     });
                 });

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list