15467: List to map changes (WIP)
authorPeter Amstutz <pamstutz@veritasgenetics.com>
Tue, 23 Jul 2019 13:40:37 +0000 (09:40 -0400)
committerPeter Amstutz <pamstutz@veritasgenetics.com>
Mon, 29 Jul 2019 18:58:16 +0000 (14:58 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz@veritasgenetics.com>

16 files changed:
lib/config/config.default.yml
lib/config/export.go
lib/config/generated_config.go
sdk/go/arvados/config.go
services/api/app/controllers/application_controller.rb
services/api/app/controllers/arvados/v1/collections_controller.rb
services/api/app/controllers/arvados/v1/groups_controller.rb
services/api/app/controllers/arvados/v1/schema_controller.rb
services/api/app/mailers/admin_notifier.rb
services/api/app/models/arvados_model.rb
services/api/app/models/collection.rb
services/api/app/models/node.rb
services/api/app/models/user.rb
services/api/config/arvados_config.rb
services/api/test/unit/container_request_test.rb
services/api/test/unit/job_test.rb

index 595b05f8c9862304a0a677927be8524132669347..88177cb1b411bdb97cf1dc06018dc05d60f281e8 100644 (file)
@@ -178,8 +178,8 @@ Clusters:
 
       # API methods to disable. Disabled methods are not listed in the
       # discovery document, and respond 404 to all requests.
-      # Example: ["jobs.create", "pipeline_instances.create"]
-      DisabledAPIs: []
+      # Example: {"jobs.create":{}, "pipeline_instances.create": {}}
+      DisabledAPIs: {}
 
       # Interval (seconds) between asynchronous permission view updates. Any
       # permission-updating API called with the 'async' parameter schedules a an
@@ -217,7 +217,14 @@ Clusters:
       AutoSetupNewUsers: false
       AutoSetupNewUsersWithVmUUID: ""
       AutoSetupNewUsersWithRepository: false
-      AutoSetupUsernameBlacklist: [arvados, git, gitolite, gitolite-admin, root, syslog]
+      AutoSetupUsernameBlacklist:
+        arvados: {}
+        git: {}
+        gitolite: {}
+        gitolite-admin: {}
+        root: {}
+        syslog: {}
+        SAMPLE: {}
 
       # When new_users_are_active is set to true, new users will be active
       # immediately.  This skips the "self-activate" step which enforces
@@ -241,8 +248,8 @@ Clusters:
       AdminNotifierEmailFrom: arvados@example.com
       EmailSubjectPrefix: "[ARVADOS] "
       UserNotifierEmailFrom: arvados@example.com
-      NewUserNotificationRecipients: []
-      NewInactiveUserNotificationRecipients: []
+      NewUserNotificationRecipients: {}
+      NewInactiveUserNotificationRecipients: {}
 
       # Set anonymous_user_token to enable anonymous user access. You can get
       # the token by running "bundle exec ./script/get_anonymous_user_token.rb"
@@ -269,13 +276,13 @@ Clusters:
       MaxDeleteBatch: 0
 
       # Attributes to suppress in events and audit logs.  Notably,
-      # specifying ["manifest_text"] here typically makes the database
+      # specifying {"manifest_text": {}} here typically makes the database
       # smaller and faster.
       #
       # Warning: Using any non-empty value here can have undesirable side
       # effects for any client or component that relies on event logs.
       # Use at your own risk.
-      UnloggedAttributes: []
+      UnloggedAttributes: {}
 
     SystemLogs:
 
@@ -410,10 +417,12 @@ Clusters:
       # to skip the compatibility check (and display a warning message to
       # that effect).
       #
-      # Example for sites running docker < 1.10: ["v1"]
-      # Example for sites running docker >= 1.10: ["v2"]
-      # Example for disabling check: []
-      SupportedDockerImageFormats: ["v2"]
+      # Example for sites running docker < 1.10: {"v1": {}}
+      # Example for sites running docker >= 1.10: {"v2": {}}
+      # Example for disabling check: {}
+      SupportedDockerImageFormats:
+        "v2": {}
+        SAMPLE: {}
 
       # Include details about job reuse decisions in the server log. This
       # causes additional database queries to run, so it should not be
@@ -539,7 +548,8 @@ Clusters:
 
           ComputeNodeDomain: ""
           ComputeNodeNameservers:
-            - 192.168.1.1
+            "192.168.1.1": {}
+            SAMPLE: {}
 
           # Hostname to assign to a compute node when it sends a "ping" and the
           # hostname in its Node record is nil.
index 25d1b7a2cb431bee3458f42804a3ba0b50046b34..6ff72afcc1eb709e51cf8746672ce4a5014889da 100644 (file)
@@ -108,6 +108,7 @@ var whitelist = map[string]bool{
        "Containers.SLURM":                             false,
        "Containers.StaleLockTimeout":                  false,
        "Containers.SupportedDockerImageFormats":       true,
+       "Containers.SupportedDockerImageFormats.*":     true,
        "Containers.UsePreemptibleInstances":           true,
        "EnableBetaController14287":                    false,
        "Git":                                          false,
index 7704a3faefdcb17da6c9310455c427336087e640..05648ca77f6484ad55d41df044e25fde774833f7 100644 (file)
@@ -184,8 +184,8 @@ Clusters:
 
       # API methods to disable. Disabled methods are not listed in the
       # discovery document, and respond 404 to all requests.
-      # Example: ["jobs.create", "pipeline_instances.create"]
-      DisabledAPIs: []
+      # Example: {"jobs.create":{}, "pipeline_instances.create": {}}
+      DisabledAPIs: {}
 
       # Interval (seconds) between asynchronous permission view updates. Any
       # permission-updating API called with the 'async' parameter schedules a an
@@ -223,7 +223,14 @@ Clusters:
       AutoSetupNewUsers: false
       AutoSetupNewUsersWithVmUUID: ""
       AutoSetupNewUsersWithRepository: false
-      AutoSetupUsernameBlacklist: [arvados, git, gitolite, gitolite-admin, root, syslog]
+      AutoSetupUsernameBlacklist:
+        arvados: {}
+        git: {}
+        gitolite: {}
+        gitolite-admin: {}
+        root: {}
+        syslog: {}
+        SAMPLE: {}
 
       # When new_users_are_active is set to true, new users will be active
       # immediately.  This skips the "self-activate" step which enforces
@@ -247,8 +254,8 @@ Clusters:
       AdminNotifierEmailFrom: arvados@example.com
       EmailSubjectPrefix: "[ARVADOS] "
       UserNotifierEmailFrom: arvados@example.com
-      NewUserNotificationRecipients: []
-      NewInactiveUserNotificationRecipients: []
+      NewUserNotificationRecipients: {}
+      NewInactiveUserNotificationRecipients: {}
 
       # Set anonymous_user_token to enable anonymous user access. You can get
       # the token by running "bundle exec ./script/get_anonymous_user_token.rb"
@@ -275,13 +282,13 @@ Clusters:
       MaxDeleteBatch: 0
 
       # Attributes to suppress in events and audit logs.  Notably,
-      # specifying ["manifest_text"] here typically makes the database
+      # specifying {"manifest_text": {}} here typically makes the database
       # smaller and faster.
       #
       # Warning: Using any non-empty value here can have undesirable side
       # effects for any client or component that relies on event logs.
       # Use at your own risk.
-      UnloggedAttributes: []
+      UnloggedAttributes: {}
 
     SystemLogs:
 
@@ -416,10 +423,12 @@ Clusters:
       # to skip the compatibility check (and display a warning message to
       # that effect).
       #
-      # Example for sites running docker < 1.10: ["v1"]
-      # Example for sites running docker >= 1.10: ["v2"]
-      # Example for disabling check: []
-      SupportedDockerImageFormats: ["v2"]
+      # Example for sites running docker < 1.10: {"v1": {}}
+      # Example for sites running docker >= 1.10: {"v2": {}}
+      # Example for disabling check: {}
+      SupportedDockerImageFormats:
+        "v2": {}
+        SAMPLE: {}
 
       # Include details about job reuse decisions in the server log. This
       # causes additional database queries to run, so it should not be
@@ -545,7 +554,8 @@ Clusters:
 
           ComputeNodeDomain: ""
           ComputeNodeNameservers:
-            - 192.168.1.1
+            "192.168.1.1": {}
+            SAMPLE: {}
 
           # Hostname to assign to a compute node when it sends a "ping" and the
           # hostname in its Node record is nil.
index d0ab58ae426611b7a63c73c0f6ddea76106a9170..e04849bb89810b8526244e36f1e469efa832c6b8 100644 (file)
@@ -69,7 +69,7 @@ type Cluster struct {
 
        API struct {
                AsyncPermissionsUpdateInterval Duration
-               DisabledAPIs                   []string
+               DisabledAPIs                   map[string]struct{}
                MaxIndexDatabaseRead           int
                MaxItemsPerResponse            int
                MaxRequestAmplification        int
@@ -83,7 +83,7 @@ type Cluster struct {
        AuditLogs struct {
                MaxAge             Duration
                MaxDeleteBatch     int
-               UnloggedAttributes []string
+               UnloggedAttributes map[string]struct{}
        }
        Collections struct {
                BlobSigning          bool
@@ -135,10 +135,10 @@ type Cluster struct {
                AutoSetupNewUsers                     bool
                AutoSetupNewUsersWithRepository       bool
                AutoSetupNewUsersWithVmUUID           string
-               AutoSetupUsernameBlacklist            []string
+               AutoSetupUsernameBlacklist            map[string]struct{}
                EmailSubjectPrefix                    string
-               NewInactiveUserNotificationRecipients []string
-               NewUserNotificationRecipients         []string
+               NewInactiveUserNotificationRecipients map[string]struct{}
+               NewUserNotificationRecipients         map[string]struct{}
                NewUsersAreActive                     bool
                UserNotifierEmailFrom                 string
                UserProfileNotificationAddress        string
@@ -267,7 +267,7 @@ type ContainersConfig struct {
        MinRetryPeriod              Duration
        ReserveExtraRAM             ByteSize
        StaleLockTimeout            Duration
-       SupportedDockerImageFormats []string
+       SupportedDockerImageFormats map[string]struct{}
        UsePreemptibleInstances     bool
 
        JobsAPI struct {
@@ -300,7 +300,7 @@ type ContainersConfig struct {
                        DNSServerReloadCommand string
                        DNSServerUpdateCommand string
                        ComputeNodeDomain      string
-                       ComputeNodeNameservers []string
+                       ComputeNodeNameservers map[string]struct{}
                        AssignNodeHostname     string
                }
        }
index b23515dda4528b1e7f44433a8fcfa006d7ee3486..369043e780863a4f84c4c9667fda9bdff2597afb 100644 (file)
@@ -433,7 +433,7 @@ class ApplicationController < ActionController::Base
   end
 
   def disable_api_methods
-    if Rails.configuration.API.DisabledAPIs.include?(controller_name + "." + action_name)
+    if Rails.configuration.API.DisabledAPIs[controller_name + "." + action_name]
       send_error("Disabled", status: 404)
     end
   end
index a8ef4b91b4b018f863c0a156e784e05622995893..81b9ca9e5bec3d74c5b524cb351752845017b1e7 100644 (file)
@@ -152,7 +152,7 @@ class Arvados::V1::CollectionsController < ApplicationController
 
       if direction == :search_up
         # Search upstream for jobs where this locator is the output of some job
-        if !Rails.configuration.API.DisabledAPIs.include?("jobs.list")
+        if !Rails.configuration.API.DisabledAPIs["jobs.list"]
           Job.readable_by(*@read_users).where(output: loc.to_s).each do |job|
             search_edges(visited, job.uuid, :search_up)
           end
@@ -176,7 +176,7 @@ class Arvados::V1::CollectionsController < ApplicationController
         end
 
         # Search downstream for jobs where this locator is in script_parameters
-        if !Rails.configuration.API.DisabledAPIs.include?("jobs.list")
+        if !Rails.configuration.API.DisabledAPIs["jobs.list"]
           Job.readable_by(*@read_users).where(["jobs.script_parameters like ?", "%#{loc.to_s}%"]).each do |job|
             search_edges(visited, job.uuid, :search_down)
           end
@@ -245,7 +245,7 @@ class Arvados::V1::CollectionsController < ApplicationController
           if direction == :search_up
             visited[c.uuid] = c.as_api_response
 
-            if !Rails.configuration.API.DisabledAPIs.include?("jobs.list")
+            if !Rails.configuration.API.DisabledAPIs["jobs.list"]
               Job.readable_by(*@read_users).where(output: c.portable_data_hash).each do |job|
                 search_edges(visited, job.uuid, :search_up)
               end
index d502d5a698e647c7806a6be0ff5497aa6b0f43a8..46d3a75a3a24407ac8ecb1541f2e646b89daf946 100644 (file)
@@ -204,7 +204,7 @@ class Arvados::V1::GroupsController < ApplicationController
     table_names = Hash[klasses.collect { |k| [k, k.table_name] }]
 
     disabled_methods = Rails.configuration.API.DisabledAPIs
-    avail_klasses = table_names.select{|k, t| !disabled_methods.include?(t+'.index')}
+    avail_klasses = table_names.select{|k, t| !disabled_methods[t+'.index']}
     klasses = avail_klasses.keys
 
     request_filters.each do |col, op, val|
index 313fe5d0a086241ba9ca9cef95c8e29db60ad843..90d3db685ef6e7320dabb7206bad9bcf4ad7015b 100644 (file)
@@ -401,7 +401,7 @@ class Arvados::V1::SchemaController < ApplicationController
           end
         end
       end
-      Rails.configuration.API.DisabledAPIs.each do |method|
+      Rails.configuration.API.DisabledAPIs.each do |method, _|
         ctrl, action = method.split('.', 2)
         discovery[:resources][ctrl][:methods].delete(action.to_sym)
       end
index 45e329030f6bfd54e7aea559d011029ab932bdb1..2c39a3924e7a65b3c3b105abff3e01224f25ac5a 100644 (file)
@@ -10,7 +10,7 @@ class AdminNotifier < ActionMailer::Base
   def new_user(user)
     @user = user
     if not Rails.configuration.Users.NewUserNotificationRecipients.empty? then
-      @recipients = Rails.configuration.Users.NewUserNotificationRecipients
+      @recipients = Rails.configuration.Users.NewUserNotificationRecipients.keys
       logger.info "Sending mail to #{@recipients} about new user #{@user.uuid} (#{@user.full_name} <#{@user.email}>)"
 
       add_to_subject = ''
@@ -27,7 +27,7 @@ class AdminNotifier < ActionMailer::Base
   def new_inactive_user(user)
     @user = user
     if not Rails.configuration.Users.NewInactiveUserNotificationRecipients.empty? then
-      @recipients = Rails.configuration.Users.NewInactiveUserNotificationRecipients
+      @recipients = Rails.configuration.Users.NewInactiveUserNotificationRecipients.keys
       logger.info "Sending mail to #{@recipients} about new user #{@user.uuid} (#{@user.full_name} <#{@user.email}>)"
       mail(to: @recipients,
            subject: "#{Rails.configuration.Users.EmailSubjectPrefix}New inactive user notification"
index 8c8ad8e254467cadbb5874c3f7519a574ccfe21c..f93312693307c39f1c39a85694cfe51011ecdc09 100644 (file)
@@ -422,7 +422,7 @@ class ArvadosModel < ApplicationRecord
   end
 
   def logged_attributes
-    attributes.except(*Rails.configuration.AuditLogs.UnloggedAttributes)
+    attributes.except(*Rails.configuration.AuditLogs.UnloggedAttributes.keys)
   end
 
   def self.full_text_searchable_columns
index ac00e5d39c2cce78c1dd26cfca3fba285810b80e..649e0f5d090680921d58ea2af53df27fe1b170d2 100644 (file)
@@ -489,13 +489,17 @@ class Collection < ArvadosModel
         [c.portable_data_hash, c]
       }]
 
+    puts "mg #{migrated_collections} #{collections}"
+
     collections.map { |c|
       # Check if the listed image is compatible first, if not, then try the
       # migration link.
       manifest = Keep::Manifest.new(c.manifest_text)
+      puts "m1 #{manifest.exact_file_count?(1)} #{manifest.files[0][1]} #{pattern}"
       if manifest.exact_file_count?(1) and manifest.files[0][1] =~ pattern
         c
       elsif m = migrated_collections[migrations[c.portable_data_hash]]
+        puts "m2 #{manifest.exact_file_count?(1)} #{manifest.files[0][1]} #{pattern}"
         manifest = Keep::Manifest.new(m.manifest_text)
         if manifest.exact_file_count?(1) and manifest.files[0][1] =~ pattern
           m
@@ -521,7 +525,7 @@ class Collection < ArvadosModel
       joins("JOIN collections ON links.head_uuid = collections.uuid").
       order("links.created_at DESC")
 
-    docker_image_formats = Rails.configuration.Containers.SupportedDockerImageFormats
+    docker_image_formats = Rails.configuration.Containers.SupportedDockerImageFormats.keys.map(&:to_s)
 
     if (docker_image_formats.include? 'v1' and
         docker_image_formats.include? 'v2') or filter_compatible_format == false
index 044d83c287969cbcc61f7cec7724b8be630037de..d200bb80110869ade17386d3ebbac9cf9b8de979 100644 (file)
@@ -39,7 +39,7 @@ class Node < ArvadosModel
   api_accessible :superuser, :extend => :user do |t|
     t.add :first_ping_at
     t.add :info
-    t.add lambda { |x| Rails.configuration.Containers.SLURM.Managed.ComputeNodeNameservers }, :as => :nameservers
+    t.add lambda { |x| Rails.configuration.Containers.SLURM.Managed.ComputeNodeNameservers.keys }, :as => :nameservers
   end
 
   after_initialize do
index fc5ae0a49db5b2fb05036a0587759d92378358cf..ee44812e0075aaa1eb0b71a66a8c60ec73907930 100644 (file)
@@ -381,7 +381,7 @@ class User < ArvadosModel
     quoted_name = self.class.connection.quote_string(basename)
     next_username = basename
     next_suffix = 1
-    while Rails.configuration.Users.AutoSetupUsernameBlacklist.include?(next_username)
+    while Rails.configuration.Users.AutoSetupUsernameBlacklist[next_username]
       next_suffix += 1
       next_username = "%s%i" % [basename, next_suffix]
     end
index cf4b842c4a93cef5900c66aa67cbfd259bb031db..575c5f717f4dd75286dd6167665b9d29099c08bc 100644 (file)
@@ -73,12 +73,20 @@ end
 # Now make a copy
 $arvados_config = $arvados_config_global.deep_dup
 
+def arrayToHash cfg, k, v
+  val = {}
+  v.each do |k|
+    val[k.to_s] = {}
+  end
+  ConfigLoader.set_cfg cfg, k, val
+end
+
 # Declare all our configuration items.
 arvcfg = ConfigLoader.new
 arvcfg.declare_config "ClusterID", NonemptyString, :uuid_prefix
 arvcfg.declare_config "ManagementToken", String, :ManagementToken
 arvcfg.declare_config "Git.Repositories", String, :git_repositories_dir
-arvcfg.declare_config "API.DisabledAPIs", Array, :disable_api_methods
+arvcfg.declare_config "API.DisabledAPIs", Hash, :disable_api_methods, method(:arrayToHash)
 arvcfg.declare_config "API.MaxRequestSize", Integer, :max_request_size
 arvcfg.declare_config "API.MaxIndexDatabaseRead", Integer, :max_index_database_read
 arvcfg.declare_config "API.MaxItemsPerResponse", Integer, :max_items_per_response
@@ -87,7 +95,7 @@ arvcfg.declare_config "API.RailsSessionSecretToken", NonemptyString, :secret_tok
 arvcfg.declare_config "Users.AutoSetupNewUsers", Boolean, :auto_setup_new_users
 arvcfg.declare_config "Users.AutoSetupNewUsersWithVmUUID", String, :auto_setup_new_users_with_vm_uuid
 arvcfg.declare_config "Users.AutoSetupNewUsersWithRepository", Boolean, :auto_setup_new_users_with_repository
-arvcfg.declare_config "Users.AutoSetupUsernameBlacklist", Array, :auto_setup_name_blacklist
+arvcfg.declare_config "Users.AutoSetupUsernameBlacklist", Hash, :auto_setup_name_blacklist, method(:arrayToHash)
 arvcfg.declare_config "Users.NewUsersAreActive", Boolean, :new_users_are_active
 arvcfg.declare_config "Users.AutoAdminUserWithEmail", String, :auto_admin_user
 arvcfg.declare_config "Users.AutoAdminFirstUser", Boolean, :auto_admin_first_user
@@ -95,15 +103,15 @@ arvcfg.declare_config "Users.UserProfileNotificationAddress", String, :user_prof
 arvcfg.declare_config "Users.AdminNotifierEmailFrom", String, :admin_notifier_email_from
 arvcfg.declare_config "Users.EmailSubjectPrefix", String, :email_subject_prefix
 arvcfg.declare_config "Users.UserNotifierEmailFrom", String, :user_notifier_email_from
-arvcfg.declare_config "Users.NewUserNotificationRecipients", Array, :new_user_notification_recipients
-arvcfg.declare_config "Users.NewInactiveUserNotificationRecipients", Array, :new_inactive_user_notification_recipients
+arvcfg.declare_config "Users.NewUserNotificationRecipients", Hash, :new_user_notification_recipients, method(:arrayToHash)
+arvcfg.declare_config "Users.NewInactiveUserNotificationRecipients", Hash, :new_inactive_user_notification_recipients, method(:arrayToHash)
 arvcfg.declare_config "Login.ProviderAppSecret", NonemptyString, :sso_app_secret
 arvcfg.declare_config "Login.ProviderAppID", NonemptyString, :sso_app_id
 arvcfg.declare_config "TLS.Insecure", Boolean, :sso_insecure
 arvcfg.declare_config "Services.SSO.ExternalURL", NonemptyString, :sso_provider_url
 arvcfg.declare_config "AuditLogs.MaxAge", ActiveSupport::Duration, :max_audit_log_age
 arvcfg.declare_config "AuditLogs.MaxDeleteBatch", Integer, :max_audit_log_delete_batch
-arvcfg.declare_config "AuditLogs.UnloggedAttributes", Array, :unlogged_attributes
+arvcfg.declare_config "AuditLogs.UnloggedAttributes", Hash, :unlogged_attributes, method(:arrayToHash)
 arvcfg.declare_config "SystemLogs.MaxRequestLogParamsSize", Integer, :max_request_log_params_size
 arvcfg.declare_config "Collections.DefaultReplication", Integer, :default_collection_replication
 arvcfg.declare_config "Collections.DefaultTrashLifetime", ActiveSupport::Duration, :default_trash_lifetime
@@ -113,7 +121,7 @@ arvcfg.declare_config "Collections.TrashSweepInterval", ActiveSupport::Duration,
 arvcfg.declare_config "Collections.BlobSigningKey", NonemptyString, :blob_signing_key
 arvcfg.declare_config "Collections.BlobSigningTTL", ActiveSupport::Duration, :blob_signature_ttl
 arvcfg.declare_config "Collections.BlobSigning", Boolean, :permit_create_collection_with_unsigned_manifest, ->(cfg, k, v) { ConfigLoader.set_cfg cfg, "Collections.BlobSigning", !v }
-arvcfg.declare_config "Containers.SupportedDockerImageFormats", Array, :docker_image_formats
+arvcfg.declare_config "Containers.SupportedDockerImageFormats", Hash, :docker_image_formats, method(:arrayToHash)
 arvcfg.declare_config "Containers.LogReuseDecisions", Boolean, :log_reuse_decisions
 arvcfg.declare_config "Containers.DefaultKeepCacheRAM", Integer, :container_default_keep_cache_ram
 arvcfg.declare_config "Containers.MaxDispatchAttempts", Integer, :max_container_dispatch_attempts
@@ -135,7 +143,7 @@ arvcfg.declare_config "Containers.SLURM.Managed.DNSServerConfTemplate", Pathname
 arvcfg.declare_config "Containers.SLURM.Managed.DNSServerReloadCommand", String, :dns_server_reload_command
 arvcfg.declare_config "Containers.SLURM.Managed.DNSServerUpdateCommand", String, :dns_server_update_command
 arvcfg.declare_config "Containers.SLURM.Managed.ComputeNodeDomain", String, :compute_node_domain
-arvcfg.declare_config "Containers.SLURM.Managed.ComputeNodeNameservers", Array, :compute_node_nameservers
+arvcfg.declare_config "Containers.SLURM.Managed.ComputeNodeNameservers", Hash, :compute_node_nameservers, method(:arrayToHash)
 arvcfg.declare_config "Containers.SLURM.Managed.AssignNodeHostname", String, :assign_node_hostname
 arvcfg.declare_config "Containers.JobsAPI.Enable", String, :enable_legacy_jobs_api, ->(cfg, k, v) { ConfigLoader.set_cfg cfg, "Containers.JobsAPI.Enable", v.to_s }
 arvcfg.declare_config "Containers.JobsAPI.CrunchJobWrapper", String, :crunch_job_wrapper
index 69e277cc2c000ae627c4b1193c629ac8cf99e7dc..2637e77937b1cb8b5954abed52d66c382fe4f24a 100644 (file)
@@ -515,7 +515,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
   test "Container.resolve_container_image(pdh)" do
     set_user_from_auth :active
     [[:docker_image, 'v1'], [:docker_image_1_12, 'v2']].each do |coll, ver|
-      Rails.configuration.Containers.SupportedDockerImageFormats = [ver]
+      Rails.configuration.Containers.SupportedDockerImageFormats = {ver=>{}}
       pdh = collections(coll).portable_data_hash
       resolved = Container.resolve_container_image(pdh)
       assert_equal resolved, pdh
@@ -541,7 +541,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
   end
 
   test "migrated docker image" do
-    Rails.configuration.Containers.SupportedDockerImageFormats = ['v2']
+    Rails.configuration.Containers.SupportedDockerImageFormats = {'v2'=>{}}
     add_docker19_migration_link
 
     # Test that it returns only v2 images even though request is for v1 image.
@@ -559,7 +559,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
   end
 
   test "use unmigrated docker image" do
-    Rails.configuration.Containers.SupportedDockerImageFormats = ['v1']
+    Rails.configuration.Containers.SupportedDockerImageFormats = {'v1'=>{}}
     add_docker19_migration_link
 
     # Test that it returns only supported v1 images even though there is a
@@ -578,7 +578,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
   end
 
   test "incompatible docker image v1" do
-    Rails.configuration.Containers.SupportedDockerImageFormats = ['v1']
+    Rails.configuration.Containers.SupportedDockerImageFormats = {'v1'=>{}}
     add_docker19_migration_link
 
     # Don't return unsupported v2 image even if we ask for it directly.
@@ -591,7 +591,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
   end
 
   test "incompatible docker image v2" do
-    Rails.configuration.Containers.SupportedDockerImageFormats = ['v2']
+    Rails.configuration.Containers.SupportedDockerImageFormats = {'v2'=>{}}
     # No migration link, don't return unsupported v1 image,
 
     set_user_from_auth :active
index f47a1c10f9b0d1b9d9cf6031c3d5b87446a9a29b..33985ac9ecd02c6496017a39dbd48724fd5dbd93 100644 (file)
@@ -426,7 +426,7 @@ class JobTest < ActiveSupport::TestCase
   end
 
   test "use migrated docker image if requesting old-format image by tag" do
-    Rails.configuration.Containers.SupportedDockerImageFormats = ['v2']
+    Rails.configuration.Containers.SupportedDockerImageFormats = {'v2'=>{}}
     add_docker19_migration_link
     job = Job.create!(
       job_attrs(
@@ -438,7 +438,7 @@ class JobTest < ActiveSupport::TestCase
   end
 
   test "use migrated docker image if requesting old-format image by pdh" do
-    Rails.configuration.Containers.SupportedDockerImageFormats = ['v2']
+    Rails.configuration.Containers.SupportedDockerImageFormats = {'v2'=>{}}
     add_docker19_migration_link
     job = Job.create!(
       job_attrs(
@@ -455,7 +455,7 @@ class JobTest < ActiveSupport::TestCase
    [:docker_image_1_12, :docker_image_1_12, :docker_image_1_12],
   ].each do |existing_image, request_image, expect_image|
     test "if a #{existing_image} job exists, #{request_image} yields #{expect_image} after migration" do
-      Rails.configuration.Containers.SupportedDockerImageFormats = ['v1']
+      Rails.configuration.Containers.SupportedDockerImageFormats = {'v1'=>{}}
 
       if existing_image == :docker_image
         oldjob = Job.create!(
@@ -477,7 +477,7 @@ class JobTest < ActiveSupport::TestCase
         end
       end
 
-      Rails.configuration.Containers.SupportedDockerImageFormats = ['v2']
+      Rails.configuration.Containers.SupportedDockerImageFormats = {'v2'=>{}}
       add_docker19_migration_link
 
       # Check that both v1 and v2 images get resolved to v2.