[ARVADOS] updated: 1.3.0-554-gc6d7d8d61

Git user git at public.curoverse.com
Tue Mar 26 17:43:56 UTC 2019


Summary of changes:
 .../api/app/controllers/arvados/v1/healthcheck_controller.rb |  2 +-
 services/api/app/models/node.rb                              | 12 ++++++------
 services/api/app/models/user.rb                              |  2 +-
 services/api/config/initializers/load_config.rb              |  8 ++++----
 services/api/lib/config_loader.rb                            | 12 ++++++++++++
 services/api/lib/crunch_dispatch.rb                          |  4 ++--
 .../api/test/functional/arvados/v1/schema_controller_test.rb |  6 +++---
 services/api/test/unit/node_test.rb                          |  4 ++--
 services/api/test/unit/user_test.rb                          |  6 +++---
 9 files changed, 34 insertions(+), 22 deletions(-)

       via  c6d7d8d61f0f74e7342fb932738b51f812e89940 (commit)
      from  c91ff37a9ce0ab53bbc289e3b69de782525e6299 (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 c6d7d8d61f0f74e7342fb932738b51f812e89940
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Tue Mar 26 13:43:39 2019 -0400

    13996: Unit tests pass
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/services/api/app/controllers/arvados/v1/healthcheck_controller.rb b/services/api/app/controllers/arvados/v1/healthcheck_controller.rb
index 6d55506bb..6dca95f6c 100644
--- a/services/api/app/controllers/arvados/v1/healthcheck_controller.rb
+++ b/services/api/app/controllers/arvados/v1/healthcheck_controller.rb
@@ -19,7 +19,7 @@ class Arvados::V1::HealthcheckController < ApplicationController
     mgmt_token = Rails.configuration.ManagementToken
     auth_header = request.headers['Authorization']
 
-    if !mgmt_token
+    if mgmt_token == ""
       send_json ({"errors" => "disabled"}), status: 404
     elsif !auth_header
       send_json ({"errors" => "authorization required"}), status: 401
diff --git a/services/api/app/models/node.rb b/services/api/app/models/node.rb
index e3a4b8b41..c2c5e2fed 100644
--- a/services/api/app/models/node.rb
+++ b/services/api/app/models/node.rb
@@ -195,8 +195,8 @@ class Node < ArvadosModel
       ptr_domain: ptr_domain,
     }
 
-    if (!Rails.configuration.Containers["SLURM"]["Managed"]["DNSServerConfDir"].empty? and
-        !Rails.configuration.Containers["SLURM"]["Managed"]["DNSServerConfTemplate"].empty?)
+    if (!Rails.configuration.Containers["SLURM"]["Managed"]["DNSServerConfDir"].to_s.empty? and
+        !Rails.configuration.Containers["SLURM"]["Managed"]["DNSServerConfTemplate"].to_s.empty?)
       tmpfile = nil
       begin
         begin
@@ -232,8 +232,8 @@ class Node < ArvadosModel
       end
     end
 
-    if (!Rails.configuration.Containers["SLURM"]["Managed"]["DNSServerConfDir"].empty? and
-        !Rails.configuration.Containers["SLURM"]["Managed"]["DNSServerReloadCommand"].empty?)
+    if (!Rails.configuration.Containers["SLURM"]["Managed"]["DNSServerConfDir"].to_s.empty? and
+        !Rails.configuration.Containers["SLURM"]["Managed"]["DNSServerReloadCommand"].to_s.empty?)
       restartfile = File.join(Rails.configuration.Containers["SLURM"]["Managed"]["DNSServerConfDir"], 'restart.txt')
       begin
         File.open(restartfile, 'w') do |f|
@@ -259,8 +259,8 @@ class Node < ArvadosModel
 
   # At startup, make sure all DNS entries exist.  Otherwise, slurmctld
   # will refuse to start.
-  if (!Rails.configuration.Containers["SLURM"]["Managed"]["DNSServerConfDir"].empty? and
-      !Rails.configuration.Containers["SLURM"]["Managed"]["DNSServerConfTemplate"].empty? and
+  if (!Rails.configuration.Containers["SLURM"]["Managed"]["DNSServerConfDir"].to_s.empty? and
+      !Rails.configuration.Containers["SLURM"]["Managed"]["DNSServerConfTemplate"].to_s.empty? and
       !Rails.configuration.Containers["SLURM"]["Managed"]["AssignNodeHostname"].empty?)
 
     (0..Rails.configuration.Containers["MaxComputeVMs"]-1).each do |slot_number|
diff --git a/services/api/app/models/user.rb b/services/api/app/models/user.rb
index 8735dbabf..1927449d3 100644
--- a/services/api/app/models/user.rb
+++ b/services/api/app/models/user.rb
@@ -493,7 +493,7 @@ class User < ArvadosModel
   # create login permission for the given vm_uuid, if it does not already exist
   def create_vm_login_permission_link(vm_uuid, repo_name)
     # vm uuid is optional
-    return if !vm_uuid
+    return if vm_uuid == ""
 
     vm = VirtualMachine.where(uuid: vm_uuid).first
     if !vm
diff --git a/services/api/config/initializers/load_config.rb b/services/api/config/initializers/load_config.rb
index bc58dbfc5..f30dae09f 100644
--- a/services/api/config/initializers/load_config.rb
+++ b/services/api/config/initializers/load_config.rb
@@ -43,7 +43,7 @@ end
 
 declare_config "ClusterID", NonemptyString, :uuid_prefix
 declare_config "ManagementToken", String, :ManagementToken
-declare_config "Git.Repositories", String, :git_repositories_dir
+declare_config "Git.Repositories", Pathname, :git_repositories_dir
 declare_config "API.DisabledAPIs", Array, :disable_api_methods
 declare_config "API.MaxRequestSize", Integer, :max_request_size
 declare_config "API.MaxIndexDatabaseRead", Integer, :max_index_database_read
@@ -95,8 +95,8 @@ declare_config "Containers.Logging.LogPartialLineThrottlePeriod", ActiveSupport:
 declare_config "Containers.Logging.LogUpdatePeriod", ActiveSupport::Duration, :crunch_log_update_period
 declare_config "Containers.Logging.LogUpdateSize", Integer, :crunch_log_update_size
 declare_config "Containers.Logging.MaxAge", ActiveSupport::Duration, :clean_container_log_rows_after
-declare_config "Containers.SLURM.Managed.DNSServerConfDir", String, :dns_server_conf_dir
-declare_config "Containers.SLURM.Managed.DNSServerConfTemplate", String, :dns_server_conf_template
+declare_config "Containers.SLURM.Managed.DNSServerConfDir", Pathname, :dns_server_conf_dir
+declare_config "Containers.SLURM.Managed.DNSServerConfTemplate", Pathname, :dns_server_conf_template
 declare_config "Containers.SLURM.Managed.DNSServerReloadCommand", String, :dns_server_reload_command
 declare_config "Containers.SLURM.Managed.DNSServerUpdateCommand", String, :dns_server_update_command
 declare_config "Containers.SLURM.Managed.ComputeNodeDomain", String, :compute_node_domain
@@ -106,7 +106,7 @@ declare_config "Containers.JobsAPI.Enable", String, :enable_legacy_jobs_api, ->(
 declare_config "Containers.JobsAPI.CrunchJobWrapper", String, :crunch_job_wrapper
 declare_config "Containers.JobsAPI.CrunchJobUser", String, :crunch_job_user
 declare_config "Containers.JobsAPI.CrunchRefreshTrigger", String, :crunch_refresh_trigger
-declare_config "Containers.JobsAPI.GitInternalDir", String, :git_internal_dir
+declare_config "Containers.JobsAPI.GitInternalDir", Pathname, :git_internal_dir
 declare_config "Containers.JobsAPI.ReuseJobIfOutputsDiffer", Boolean, :reuse_job_if_outputs_differ
 declare_config "Containers.JobsAPI.DefaultDockerImage", String, :default_docker_image_for_jobs
 declare_config "Mail.MailchimpAPIKey", String, :mailchimp_api_key
diff --git a/services/api/lib/config_loader.rb b/services/api/lib/config_loader.rb
index fbb7213fa..3e3c82a36 100644
--- a/services/api/lib/config_loader.rb
+++ b/services/api/lib/config_loader.rb
@@ -113,6 +113,18 @@ def coercion_and_check check_cfg
       cfg[k] = cfg[k].to_s
     end
 
+    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"
+        end
+      end
+    end
+
     if cfgtype == NonemptyString
       if (!cfg[k] || cfg[k] == "")
         raise "#{cfgkey} cannot be empty"
diff --git a/services/api/lib/crunch_dispatch.rb b/services/api/lib/crunch_dispatch.rb
index f3e17ffa2..0ebb510b5 100644
--- a/services/api/lib/crunch_dispatch.rb
+++ b/services/api/lib/crunch_dispatch.rb
@@ -338,13 +338,13 @@ class CrunchDispatch
 
       cmd_args = nil
       case Rails.configuration.Containers["JobsAPI"]["CrunchJobWrapper"]
-      when :none
+      when "none"
         if @running.size > 0
             # Don't run more than one at a time.
             return
         end
         cmd_args = []
-      when :slurm_immediate
+      when "slurm_immediate"
         nodelist = nodes_available_for_job(job)
         if nodelist.nil?
           if Time.now < @node_wait_deadline
diff --git a/services/api/test/functional/arvados/v1/schema_controller_test.rb b/services/api/test/functional/arvados/v1/schema_controller_test.rb
index 9d4912805..5c7b54067 100644
--- a/services/api/test/functional/arvados/v1/schema_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/schema_controller_test.rb
@@ -29,12 +29,12 @@ class Arvados::V1::SchemaControllerTest < ActionController::TestCase
     assert_response :success
     discovery_doc = JSON.parse(@response.body)
     assert_includes discovery_doc, 'defaultTrashLifetime'
-    assert_equal discovery_doc['defaultTrashLifetime'], Rails.application.config.default_trash_lifetime
+    assert_equal discovery_doc['defaultTrashLifetime'], Rails.configuration.Collections["DefaultTrashLifetime"]
     assert_match(/^[0-9a-f]+(-modified)?$/, discovery_doc['source_version'])
     assert_match(/^[0-9a-f]+(-modified)?$/, discovery_doc['sourceVersion'])
     assert_match(/^unknown$/, discovery_doc['packageVersion'])
-    assert_equal discovery_doc['websocketUrl'], Rails.application.config.websocket_address
-    assert_equal discovery_doc['workbenchUrl'], Rails.application.config.workbench_address
+    assert_equal discovery_doc['websocketUrl'], Rails.configuration.Services["Websocket"]["ExternalURL"]
+    assert_equal discovery_doc['workbenchUrl'], Rails.configuration.Services["Workbench1"]["ExternalURL"]
     assert_equal('zzzzz', discovery_doc['uuidPrefix'])
   end
 
diff --git a/services/api/test/unit/node_test.rb b/services/api/test/unit/node_test.rb
index 7e6a01db6..97eddc215 100644
--- a/services/api/test/unit/node_test.rb
+++ b/services/api/test/unit/node_test.rb
@@ -75,8 +75,8 @@ class NodeTest < ActiveSupport::TestCase
   end
 
   test "dns update with no commands/dirs configured" do
-    Rails.configuration.Containers["SLURM"]["Managed"]["DNSServerUpdateCommand"] = false
-    Rails.configuration.Containers["SLURM"]["Managed"]["DNSServerConfDir"] = false
+    Rails.configuration.Containers["SLURM"]["Managed"]["DNSServerUpdateCommand"] = ""
+    Rails.configuration.Containers["SLURM"]["Managed"]["DNSServerConfDir"] = ""
     Rails.configuration.Containers["SLURM"]["Managed"]["DNSServerConfTemplate"] = 'ignored!'
     Rails.configuration.Containers["SLURM"]["Managed"]["DNSServerReloadCommand"] = 'ignored!'
     assert Node.dns_server_update 'compute65535', '127.0.0.127'
diff --git a/services/api/test/unit/user_test.rb b/services/api/test/unit/user_test.rb
index 52333db8e..5ee9bb039 100644
--- a/services/api/test/unit/user_test.rb
+++ b/services/api/test/unit/user_test.rb
@@ -157,8 +157,8 @@ class UserTest < ActiveSupport::TestCase
    [false, 'bar at example.com', nil, true],
    [true, 'foo at example.com', true, nil],
    [true, 'bar at example.com', true, true],
-   [false, false, nil, nil],
-   [true, false, true, nil]
+   [false, '', nil, nil],
+   [true, '', true, nil]
   ].each do |auto_admin_first_user_config, auto_admin_user_config, foo_should_be_admin, bar_should_be_admin|
     # In each case, 'foo' is created first, then 'bar', then 'bar2', then 'baz'.
     test "auto admin with auto_admin_first=#{auto_admin_first_user_config} auto_admin=#{auto_admin_user_config}" do
@@ -657,7 +657,7 @@ class UserTest < ActiveSupport::TestCase
                          named_repo.uuid, user.uuid, "permission", "can_manage")
     end
     # Check for VM login.
-    if auto_vm_uuid = Rails.configuration.Users["AutoSetupNewUsersWithVmUUID"]
+    if (auto_vm_uuid = Rails.configuration.Users["AutoSetupNewUsersWithVmUUID"]) != ""
       verify_link_exists(can_setup, auto_vm_uuid, user.uuid,
                          "permission", "can_login", "username", expect_username)
     end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list