[ARVADOS] updated: 6ff244f2613d1f93f644f627f4cc5ba72790861f

git at public.curoverse.com git at public.curoverse.com
Thu Jan 9 18:16:38 EST 2014


Summary of changes:
 .../app/views/user_agreements/index.html.erb       |    2 +-
 sdk/cli/bin/arv-tag                                |   94 +++++++++++++-------
 services/api/app/controllers/static_controller.rb  |    2 +-
 .../api/config/environments/development.rb.example |    3 +
 .../api/config/environments/production.rb.example  |    3 +
 services/api/config/environments/test.rb.example   |    3 +
 services/api/script/rails                          |    2 +-
 7 files changed, 74 insertions(+), 35 deletions(-)

       via  6ff244f2613d1f93f644f627f4cc5ba72790861f (commit)
       via  b4ca2d58ba0a42be2978d2d4a87c16a98d105e5a (commit)
       via  a61fbab411d08e5d7a1cbf5e9a9c711b7f2d601f (commit)
       via  f6911c2c1b39de18b136a6cf9566dba3089b33c2 (commit)
      from  20f1e7eaf6053d52210002720e2b0a0c26e5169e (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 6ff244f2613d1f93f644f627f4cc5ba72790861f
Author: Tim Pierce <twp at curoverse.com>
Date:   Thu Jan 9 18:14:21 2014 -0500

    Complete `arv tag add' and `arv tag remove' support (fixes #1530)

diff --git a/sdk/cli/bin/arv-tag b/sdk/cli/bin/arv-tag
index 67def84..ca12cb1 100755
--- a/sdk/cli/bin/arv-tag
+++ b/sdk/cli/bin/arv-tag
@@ -12,49 +12,80 @@ def usage
     "arv tag remove --all\n"
 end
 
-def tag_add(tag, obj_uuid)
-  request_body = {
-    :api_token => ENV['ARVADOS_API_TOKEN'],
-    :link => {
-      :name       => tag,
-      :link_class => :tag,
-      :head_uuid  => obj_uuid,
-    }
-  }
-
-  result = $client.execute(:api_method => $arvados.links.create,
+def api_call(method, parameters:{}, request_body:{})
+  request_body[:api_token] = ENV['ARVADOS_API_TOKEN']
+  result = $client.execute(:api_method => method,
+                           :parameters => parameters,
                            :body => request_body,
                            :authenticated => false)
 
   begin
     results = JSON.parse result.body
   rescue JSON::ParserError => e
-    $stderr.puts "Failed to parse server response:\n" + e.to_s
-    return nil
+    abort "Failed to parse server response:\n" + e.to_s
   end
 
-  if results["errors"] then
-    $stderr.puts "Error: #{results["errors"][0]}"
-    return nil
+  if results["errors"]
+    abort "Error: #{results["errors"][0]}"
   end
 
   return results
 end
 
-def tag_remove(tag, obj_uuid=nil)
-  request_body = {
-    :api_token => ENV['ARVADOS_API_TOKEN'],
-    :link => {
-      :name       => tag,
-      :link_class => :tag,
-      :head_uuid  => obj_uuid,
-    }
-  }
+def tag_add(tag, obj_uuid)
+  return api_call($arvados.links.create,
+                  request_body: {
+                    :link => {
+                      :name       => tag,
+                      :link_class => :tag,
+                      :head_uuid  => obj_uuid,
+                    }
+                  })
+end
 
-  return $client.execute(:api_method => $arvados.links.destroy,
-                         :parameters => params,
-                         :body => request_body,
-                         :authenticated => false)
+def tag_remove(tag, obj_uuids=nil)
+  # If we got a list of objects to untag, look up the uuids for the
+  # links that need to be deleted.
+  link_uuids = []
+  if obj_uuids
+    obj_uuids.each do |uuid|
+      link = api_call($arvados.links.list,
+                      request_body: {
+                        :where => {
+                          :link_class => :tag,
+                          :name => tag,
+                          :head_uuid => uuid,
+                        }
+                      })
+      if link['items_available'] > 0
+        link_uuids.push link['items'][0]['uuid']
+      end
+    end
+  else
+    all_tag_links = api_call($arvados.links.list,
+                             request_body: {
+                               :where => {
+                                 :link_class => :tag,
+                                 :name => tag,
+                               }
+                             })
+    link_uuids = all_tag_links['items'].map { |obj| obj['uuid'] }
+  end
+
+  results = []
+  if link_uuids
+    link_uuids.each do |uuid|
+      results.push api_call($arvados.links.delete, parameters:{ :uuid => uuid })
+    end
+  else
+    $stderr.puts "no tags found to remove"
+  end
+
+  return {
+    'kind' => 'arvados#linkList',
+    'items_available' => results.length,
+    'items' => results,
+  }
 end
 
 if RUBY_VERSION < '1.9.3' then
@@ -75,6 +106,7 @@ begin
   require 'google/api_client'
   require 'json'
   require 'pp'
+  require 'oj'
   require 'trollop'
 rescue LoadError
   abort <<-EOS
@@ -171,9 +203,7 @@ when 'remove'
     if $options[:all] then
       results.push(tag_remove(tag))
     else
-      $options[:object].each do |obj|
-        results.push(tag_remove(tag, obj))
-      end
+      results.push(tag_remove(tag, $options[:object]))
     end
   end
 else

commit b4ca2d58ba0a42be2978d2d4a87c16a98d105e5a
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Tue Jan 7 14:03:34 2014 -0500

    Default redirect to workbench in production configuration to workbench.`hostname`

diff --git a/services/api/config/environments/production.rb.example b/services/api/config/environments/production.rb.example
index a2a9c16..357dd60 100644
--- a/services/api/config/environments/production.rb.example
+++ b/services/api/config/environments/production.rb.example
@@ -94,7 +94,7 @@ Server::Application.configure do
   config.email_subject_prefix = '[ARVADOS] '
 
   # Visitors to the API server will be redirected to the workbench
-  config.workbench_address = "http://localhost:3000/"
+  config.workbench_address = "http://workbench." + `hostname`
 
   # The e-mail address of the user you would like to become marked as an admin
   # user on their first login.

commit a61fbab411d08e5d7a1cbf5e9a9c711b7f2d601f
Author: Tom Clegg <tom at curoverse.com>
Date:   Mon Jan 6 15:04:50 2014 -0800

    Fix mime-type lookup.
    
    refs #1813

diff --git a/apps/workbench/app/views/user_agreements/index.html.erb b/apps/workbench/app/views/user_agreements/index.html.erb
index 6cad423..53a37a2 100644
--- a/apps/workbench/app/views/user_agreements/index.html.erb
+++ b/apps/workbench/app/views/user_agreements/index.html.erb
@@ -23,7 +23,7 @@
   <div class="modal-body">
     <% if n_files == 1 %>
       <% ua = @required_user_agreements.first; file = ua.files.first %>
-      <object data="<%= url_for(controller: 'collections', action: 'show_file', uuid: ua.uuid, file: "#{file[0]}/#{file[1]}") %>" type="<%= Rack::Mime::MIME_TYPES[file[1]] || 'application/pdf' %>" width="100%" height="400px">
+      <object data="<%= url_for(controller: 'collections', action: 'show_file', uuid: ua.uuid, file: "#{file[0]}/#{file[1]}") %>" type="<%= Rack::Mime::MIME_TYPES[file[1].match(/\.\w+$/)[0]] rescue '' %>" width="100%" height="400px">
       </object>
     <% end %>
     <div class="alert alert-info">

commit f6911c2c1b39de18b136a6cf9566dba3089b33c2
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Jan 2 13:21:34 2014 -0500

    Added redirect to config file.

diff --git a/services/api/app/controllers/static_controller.rb b/services/api/app/controllers/static_controller.rb
index 9fbf806..f64e9a4 100644
--- a/services/api/app/controllers/static_controller.rb
+++ b/services/api/app/controllers/static_controller.rb
@@ -4,7 +4,7 @@ class StaticController < ApplicationController
   skip_before_filter :require_auth_scope_all, :only => [ :home, :login_failure ]
 
   def home
-    render 'intro'
+    redirect_to Rails.configuration.workbench_address
   end
 
 end
diff --git a/services/api/config/environments/development.rb.example b/services/api/config/environments/development.rb.example
index 5f6d326..dc33dce 100644
--- a/services/api/config/environments/development.rb.example
+++ b/services/api/config/environments/development.rb.example
@@ -68,6 +68,9 @@ Server::Application.configure do
   config.admin_notifier_email_from = 'arvados at example.com'
   config.email_subject_prefix = '[ARVADOS] '
 
+  # Visitors to the API server will be redirected to the workbench
+  config.workbench_address = "http://localhost:3000/"
+
   # The e-mail address of the user you would like to become marked as an admin
   # user on their first login.
   # In the default configuration, authentication happens through the Arvados SSO
diff --git a/services/api/config/environments/production.rb.example b/services/api/config/environments/production.rb.example
index a171f9d..a2a9c16 100644
--- a/services/api/config/environments/production.rb.example
+++ b/services/api/config/environments/production.rb.example
@@ -93,6 +93,9 @@ Server::Application.configure do
   config.admin_notifier_email_from = 'arvados at example.com'
   config.email_subject_prefix = '[ARVADOS] '
 
+  # Visitors to the API server will be redirected to the workbench
+  config.workbench_address = "http://localhost:3000/"
+
   # The e-mail address of the user you would like to become marked as an admin
   # user on their first login.
   # In the default configuration, authentication happens through the Arvados SSO
diff --git a/services/api/config/environments/test.rb.example b/services/api/config/environments/test.rb.example
index 5cbf27f..39cbe69 100644
--- a/services/api/config/environments/test.rb.example
+++ b/services/api/config/environments/test.rb.example
@@ -72,4 +72,7 @@ Server::Application.configure do
   config.new_users_are_active = false
   config.admin_notifier_email_from = 'arvados at example.com'
   config.email_subject_prefix = '[ARVADOS] '
+
+  # Visitors to the API server will be redirected to the workbench
+  config.workbench_address = "http://localhost:3000/"
 end
diff --git a/services/api/script/rails b/services/api/script/rails
index 7c4ec52..88627f5 100755
--- a/services/api/script/rails
+++ b/services/api/script/rails
@@ -13,7 +13,7 @@ module Rails
     class Server < ::Rack::Server
         def default_options
             super.merge({
-                :Port => 3000,
+                :Port => 3001,
                 :environment => (ENV['RAILS_ENV'] || "development").dup,
                 :daemonize => false,
                 :debugger => false,

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list