[ARVADOS] updated: 1.3.0-1254-g0ae86abfe

Git user git at public.curoverse.com
Mon Jul 8 15:06:19 UTC 2019


Summary of changes:
 apps/workbench/lib/config_loader.rb | 140 ++++++++++++++++++------------------
 1 file changed, 72 insertions(+), 68 deletions(-)

       via  0ae86abfecf30143d3e1484fedbb7ac4a2fb075a (commit)
      from  50b4bc6acb989af8902f329df284e30590b35ab1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 0ae86abfecf30143d3e1484fedbb7ac4a2fb075a
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Mon Jul 8 11:06:05 2019 -0400

    14812: Improve error reporting
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/apps/workbench/lib/config_loader.rb b/apps/workbench/lib/config_loader.rb
index c95b6181b..730e468fa 100644
--- a/apps/workbench/lib/config_loader.rb
+++ b/apps/workbench/lib/config_loader.rb
@@ -68,7 +68,11 @@ class ConfigLoader
     remainders = {}
     from_config.each do |k, v|
       if @config_migrate_map[k.to_sym]
-        @config_migrate_map[k.to_sym].call to_config, k, v
+        begin
+          @config_migrate_map[k.to_sym].call to_config, k, v
+        rescue => e
+          raise "Error migrating '#{k}: #{v}' got error #{e}"
+        end
       else
         remainders[k] = v
       end
@@ -79,90 +83,90 @@ class ConfigLoader
   def coercion_and_check check_cfg, check_nonempty: true
     @config_types.each do |cfgkey, cfgtype|
       begin
-      cfg = check_cfg
-      k = cfgkey
-      ks = k.split '.'
-      k = ks.pop
-      ks.each do |kk|
-        cfg = cfg[kk]
-        if cfg.nil?
-          break
+        cfg = check_cfg
+        k = cfgkey
+        ks = k.split '.'
+        k = ks.pop
+        ks.each do |kk|
+          cfg = cfg[kk]
+          if cfg.nil?
+            break
+          end
         end
-      end
 
-      if cfg.nil?
-        raise "missing #{cfgkey}"
-      end
+        if cfg.nil?
+          raise "missing #{cfgkey}"
+        end
 
-      if cfgtype == String and !cfg[k]
-        cfg[k] = ""
-      end
+        if cfgtype == String and !cfg[k]
+          cfg[k] = ""
+        end
 
-      if cfgtype == String and cfg[k].is_a? Symbol
-        cfg[k] = cfg[k].to_s
-      end
+        if cfgtype == String and cfg[k].is_a? Symbol
+          cfg[k] = cfg[k].to_s
+        end
 
-      if cfgtype == Pathname and cfg[k].is_a? String
+        if cfgtype == Pathname and cfg[k].is_a? String
 
-        if cfg[k] == ""
-          cfg[k] = Pathname.new("")
-        else
-          cfg[k] = Pathname.new(cfg[k])
-          if !cfg[k].exist?
-            raise "#{cfgkey} path #{cfg[k]} does not exist"
+          if cfg[k] == ""
+            cfg[k] = Pathname.new("")
+          else
+            cfg[k] = Pathname.new(cfg[k])
+            if !cfg[k].exist?
+              raise "#{cfgkey} path #{cfg[k]} does not exist"
+            end
           end
         end
-      end
 
-      if cfgtype == NonemptyString
-        if (!cfg[k] || cfg[k] == "") && check_nonempty
-          raise "#{cfgkey} cannot be empty"
-        end
-        if cfg[k].is_a? String
-          next
+        if cfgtype == NonemptyString
+          if (!cfg[k] || cfg[k] == "") && check_nonempty
+            raise "#{cfgkey} cannot be empty"
+          end
+          if cfg[k].is_a? String
+            next
+          end
         end
-      end
 
-      if cfgtype == ActiveSupport::Duration
-        if cfg[k].is_a? Integer
-          cfg[k] = cfg[k].seconds
-        elsif cfg[k].is_a? String
-          cfg[k] = ConfigLoader.parse_duration(cfg[k], cfgkey: cfgkey)
+        if cfgtype == ActiveSupport::Duration
+          if cfg[k].is_a? Integer
+            cfg[k] = cfg[k].seconds
+          elsif cfg[k].is_a? String
+            cfg[k] = ConfigLoader.parse_duration(cfg[k], cfgkey: cfgkey)
+          end
         end
-      end
 
-      if cfgtype == URI
-        if cfg[k]
-          cfg[k] = URI(cfg[k])
-        else
-          cfg[k] = URI("")
+        if cfgtype == URI
+          if cfg[k]
+            cfg[k] = URI(cfg[k])
+          else
+            cfg[k] = URI("")
+          end
         end
-      end
 
-      if cfgtype == Integer && cfg[k].is_a?(String)
-        v = cfg[k].sub(/B\s*$/, '')
-        if mt = /(-?\d*\.?\d+)\s*([KMGTPE]i?)$/.match(v)
-          if mt[1].index('.')
-            v = mt[1].to_f
-          else
-            v = mt[1].to_i
+        if cfgtype == Integer && cfg[k].is_a?(String)
+          v = cfg[k].sub(/B\s*$/, '')
+          if mt = /(-?\d*\.?\d+)\s*([KMGTPE]i?)$/.match(v)
+            if mt[1].index('.')
+              v = mt[1].to_f
+            else
+              v = mt[1].to_i
+            end
+            cfg[k] = v * {
+              'K' => 1000,
+              'Ki' => 1 << 10,
+              'M' => 1000000,
+              'Mi' => 1 << 20,
+	      "G" =>  1000000000,
+	      "Gi" => 1 << 30,
+	      "T" =>  1000000000000,
+	      "Ti" => 1 << 40,
+	      "P" =>  1000000000000000,
+	      "Pi" => 1 << 50,
+	      "E" =>  1000000000000000000,
+	      "Ei" => 1 << 60,
+            }[mt[2]]
           end
-          cfg[k] = v * {
-            'K' => 1000,
-            'Ki' => 1 << 10,
-            'M' => 1000000,
-            'Mi' => 1 << 20,
-	    "G" =>  1000000000,
-	    "Gi" => 1 << 30,
-	    "T" =>  1000000000000,
-	    "Ti" => 1 << 40,
-	    "P" =>  1000000000000000,
-	    "Pi" => 1 << 50,
-	    "E" =>  1000000000000000000,
-	    "Ei" => 1 << 60,
-          }[mt[2]]
         end
-      end
 
       rescue => e
         raise "#{cfgkey} expected #{cfgtype} but '#{cfg[k]}' got error #{e}"

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list