[ARVADOS] created: 1.2.0-85-g9b1e23489
Git user
git at public.curoverse.com
Wed Sep 19 14:56:54 EDT 2018
at 9b1e23489c659655134a7e208a012d5d8d05bd07 (commit)
commit 9b1e23489c659655134a7e208a012d5d8d05bd07
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date: Wed Sep 19 14:52:54 2018 -0400
10865: Add enable_legacy_jobs_api configuration option
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/services/api/config/application.default.yml b/services/api/config/application.default.yml
index 5a1c22951..a76a567ee 100644
--- a/services/api/config/application.default.yml
+++ b/services/api/config/application.default.yml
@@ -293,6 +293,13 @@ common:
# Example: ["jobs.create", "pipeline_instances.create"]
disable_api_methods: []
+ # Enable the legacy Jobs API.
+ # auto -- (default) enable the Jobs API only if it has been used before
+ # (i.e., there are job records in the database)
+ # true -- enable the Jobs API despite lack of existing records.
+ # false -- disable the Jobs API despite presence of existing records.
+ enable_legacy_jobs_api: auto
+
###
### Crunch, DNS & compute node management
###
diff --git a/services/api/config/initializers/legacy_jobs_api.rb b/services/api/config/initializers/legacy_jobs_api.rb
new file mode 100644
index 000000000..00605725e
--- /dev/null
+++ b/services/api/config/initializers/legacy_jobs_api.rb
@@ -0,0 +1,42 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Config must be done before we files; otherwise they
+# won't be able to use Rails.configuration.* to initialize their
+# classes.
+require_relative 'load_config.rb'
+
+Server::Application.configure do
+ if Rails.configuration.enable_legacy_jobs_api == false ||
+ (Rails.configuration.enable_legacy_jobs_api == "auto" &&
+ ActiveRecord::Base.connection.exec_query("select count(*) from jobs")[0] == 0)
+ Rails.configuration.disable_api_methods = ["jobs.create",
+ "pipeline_instances.create",
+ "pipeline_templates.create",
+ "jobs.get",
+ "pipeline_instances.get",
+ "pipeline_templates.get",
+ "jobs.list",
+ "pipeline_instances.list",
+ "pipeline_templates.list",
+ "jobs.index",
+ "pipeline_instances.index",
+ "pipeline_templates.index",
+ "jobs.update",
+ "pipeline_instances.update",
+ "pipeline_templates.update",
+ "jobs.queue",
+ "jobs.queue_size",
+ "job_tasks.create",
+ "job_tasks.get",
+ "job_tasks.list",
+ "job_tasks.index",
+ "job_tasks.update",
+ "jobs.show",
+ "pipeline_instances.show",
+ "pipeline_templates.show",
+ "jobs.show",
+ "job_tasks.show"]
+ end
+end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list