[ARVADOS] created: 7284d3c35d0531473a2403335620481990cf8e03

git at public.curoverse.com git at public.curoverse.com
Sat Apr 19 02:39:48 EDT 2014


        at  7284d3c35d0531473a2403335620481990cf8e03 (commit)


commit 7284d3c35d0531473a2403335620481990cf8e03
Author: Tom Clegg <tom at curoverse.com>
Date:   Sat Apr 19 02:39:11 2014 -0400

    Fix configuration behavior in Ruby SDK.
    
    API_VERSION is not configuration: it indicates how a client program
    expects the API server to behave. (No environment variable or config
    file should try to override that.)
    
    Do not invoke insecure behavior unless API_HOST_INSECURE is "1",
    "true", or "yes".
    
    If API_HOST and API_TOKEN environment variables are set, do not bother
    reading the configuration file at all.
    
    Strip spaces so "API_TOKEN = foo" works in the configuration file.

diff --git a/sdk/ruby/lib/arvados.rb b/sdk/ruby/lib/arvados.rb
index a94eb1d..eedee6e 100644
--- a/sdk/ruby/lib/arvados.rb
+++ b/sdk/ruby/lib/arvados.rb
@@ -35,9 +35,8 @@ class Arvados
     @application_version ||= 0.0
     @application_name ||= File.split($0).last
 
-    @arvados_api_version = opts[:api_version] ||
-      config['ARVADOS_API_VERSION'] ||
-      'v1'
+    @arvados_api_version = opts[:api_version] || 'v1'
+
     @arvados_api_host = opts[:api_host] ||
       config['ARVADOS_API_HOST'] or
       raise "#{$0}: no :api_host or ENV[ARVADOS_API_HOST] provided."
@@ -46,7 +45,8 @@ class Arvados
       raise "#{$0}: no :api_token or ENV[ARVADOS_API_TOKEN] provided."
 
     if (opts[:suppress_ssl_warnings] or
-        config['ARVADOS_API_HOST_INSECURE'])
+        %w(1 true yes).index(config['ARVADOS_API_HOST_INSECURE'].
+                             andand.downcase))
       suppress_warnings do
         OpenSSL::SSL.const_set 'VERIFY_PEER', OpenSSL::SSL::VERIFY_NONE
       end
@@ -150,7 +150,15 @@ class Arvados
     config['ARVADOS_API_HOST']          = ENV['ARVADOS_API_HOST']
     config['ARVADOS_API_TOKEN']         = ENV['ARVADOS_API_TOKEN']
     config['ARVADOS_API_HOST_INSECURE'] = ENV['ARVADOS_API_HOST_INSECURE']
-    config['ARVADOS_API_VERSION']       = ENV['ARVADOS_API_VERSION']
+
+    if config['ARVADOS_API_HOST'] and config['ARVADOS_API_TOKEN']
+      # Environment variables take precedence over the config file, so
+      # there is no point reading the config file. If the environment
+      # specifies a _HOST without asking for _INSECURE, we certainly
+      # shouldn't give the config file a chance to create a
+      # system-wide _INSECURE state for this user.
+      return (@@config = config)
+    end
 
     begin
       expanded_path = File.expand_path config_file_path
@@ -162,8 +170,10 @@ class Arvados
           # skip comments and blank lines
           next if line.match('^\s*#') or not line.match('\S')
           var, val = line.chomp.split('=', 2)
+          var.strip!
+          val.strip!
           # allow environment settings to override config files.
-          if var and val
+          if val
             config[var] ||= val
           else
             warn "#{expanded_path}: #{lineno}: could not parse `#{line}'"

commit 503993c3a54e08ed176c2aed44ced0dfbb9829a2
Author: Tom Clegg <tom at curoverse.com>
Date:   Sat Apr 19 02:00:09 2014 -0400

    Show a browser alert box on AJAX error, instead of mysterious silent failure.

diff --git a/apps/workbench/app/assets/javascripts/application.js b/apps/workbench/app/assets/javascripts/application.js
index 6afc8c3..b9d9902 100644
--- a/apps/workbench/app/assets/javascripts/application.js
+++ b/apps/workbench/app/assets/javascripts/application.js
@@ -50,6 +50,12 @@ jQuery(function($){
         on('ajax:complete', function(e, status) {
             $('.loading').fadeOut('fast', 0);
         }).
+        on('ajax:error', function(e, jqxhr, status, error) {
+            if (jqxhr.responseJSON && jqxhr.responseJSON.errors)
+                window.alert("Server error: " + jqxhr.responseJSON.errors.join("; "));
+            else
+                window.alert("Server error: " + error);
+        }).
         on('click', '.removable-tag a', function(e) {
             var tag_span = $(this).parents('[data-tag-link-uuid]').eq(0)
             tag_span.fadeTo('fast', 0.2);
@@ -63,6 +69,7 @@ jQuery(function($){
                 }).
                 fail(function(jqxhr, status, error) {
                     this.addClass('label-danger').fadeTo('fast', '1');
+                    $(document).trigger('ajax:error', jqxhr, status, error);
                 });
             return false;
         }).

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list