[ARVADOS] updated: 1.3.0-558-gc6f795ff9
Git user
git at public.curoverse.com
Tue Mar 26 21:10:14 UTC 2019
Summary of changes:
services/api/config/initializers/load_config.rb | 2 ++
services/api/lib/config_loader.rb | 12 ++++++++++
services/api/lib/tasks/config_diff.rake | 32 +++++++++++++++++++++++++
3 files changed, 46 insertions(+)
create mode 100644 services/api/lib/tasks/config_diff.rake
via c6f795ff9c2dd93cea4ca2ae58abf5393a2aa311 (commit)
from 128ac1699219b68105eda2376160a3269d445845 (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 c6f795ff9c2dd93cea4ca2ae58abf5393a2aa311
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date: Tue Mar 26 17:10:00 2019 -0400
13996: Add rake config:diff
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/services/api/config/initializers/load_config.rb b/services/api/config/initializers/load_config.rb
index 79cf5bd0f..51b2bec0d 100644
--- a/services/api/config/initializers/load_config.rb
+++ b/services/api/config/initializers/load_config.rb
@@ -41,6 +41,8 @@ $arvados_config = {}
end
end
+$base_arvados_config = $arvados_config.deep_dup
+
declare_config "ClusterID", NonemptyString, :uuid_prefix
declare_config "ManagementToken", String, :ManagementToken
declare_config "Git.Repositories", Pathname, :git_repositories_dir
diff --git a/services/api/lib/config_loader.rb b/services/api/lib/config_loader.rb
index 3e3c82a36..8b31a62c4 100644
--- a/services/api/lib/config_loader.rb
+++ b/services/api/lib/config_loader.rb
@@ -24,6 +24,18 @@ module Psych
end
@emitter.scalar outstr, nil, nil, true, false, Nodes::Scalar::ANY
end
+
+ def visit_URI_Generic o
+ @emitter.scalar o.to_s, nil, nil, true, false, Nodes::Scalar::ANY
+ end
+
+ def visit_URI_HTTP o
+ @emitter.scalar o.to_s, nil, nil, true, false, Nodes::Scalar::ANY
+ end
+
+ def visit_Pathname o
+ @emitter.scalar o.to_s, nil, nil, true, false, Nodes::Scalar::ANY
+ end
end
end
end
diff --git a/services/api/lib/tasks/config_diff.rake b/services/api/lib/tasks/config_diff.rake
new file mode 100644
index 000000000..a9249df3a
--- /dev/null
+++ b/services/api/lib/tasks/config_diff.rake
@@ -0,0 +1,32 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+def diff_hash base, final
+ diffed = {}
+ base.each do |k,v|
+ bk = base[k]
+ fk = final[k]
+ if bk.is_a? Hash
+ d = diff_hash bk, fk
+ if d.length > 0
+ diffed[k] = d
+ end
+ else
+ if bk.to_s != fk.to_s
+ diffed[k] = fk
+ end
+ end
+ end
+ diffed
+end
+
+namespace :config do
+ desc 'Diff site configuration'
+ task diff: :environment do
+ diffed = diff_hash $base_arvados_config, $arvados_config
+ cfg = { "Clusters" => {}}
+ cfg["Clusters"][$arvados_config["ClusterID"]] = diffed.select {|k,v| k != "ClusterID"}
+ puts cfg.to_yaml
+ end
+end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list