summaryrefslogtreecommitdiff
path: root/lib/tasks
diff options
context:
space:
mode:
authorAlejandro Rodríguez <alejorro70@gmail.com>2017-06-12 17:37:43 -0400
committerAlejandro Rodríguez <alejorro70@gmail.com>2017-06-14 19:33:43 -0400
commit58821ebbb4fa1bbd280749ca2f64d7592a852c98 (patch)
tree72e1fad3639d2132e7ef554c67e12f1c848c7453 /lib/tasks
parent5468bf7e0b2c6bf39f5a9b43b5b3864e7e57556d (diff)
downloadgitlab-ce-58821ebbb4fa1bbd280749ca2f64d7592a852c98.tar.gz
Stop using deprecated `path` field on Gitaly messages
This revealed an error in our configuration generation in gitlab:gitaly:install rake task. The fix is included
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/gitlab/gitaly.rake20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/tasks/gitlab/gitaly.rake b/lib/tasks/gitlab/gitaly.rake
index 3c5bc0146a1..e88111c3725 100644
--- a/lib/tasks/gitlab/gitaly.rake
+++ b/lib/tasks/gitlab/gitaly.rake
@@ -30,11 +30,7 @@ namespace :gitlab do
puts "# Gitaly storage configuration generated from #{Gitlab.config.source} on #{Time.current.to_s(:long)}"
puts "# This is in TOML format suitable for use in Gitaly's config.toml file."
- config = Gitlab.config.repositories.storages.map do |key, val|
- { name: key, path: val['path'] }
- end
-
- puts TOML.dump(storage: config)
+ puts gitaly_configuration_toml
end
private
@@ -42,10 +38,10 @@ namespace :gitlab do
# We cannot create config.toml files for all possible Gitaly configuations.
# For instance, if Gitaly is running on another machine then it makes no
# sense to write a config.toml file on the current machine. This method will
- # only write a config.toml file in the most common and simplest case: the
- # case where we have exactly one Gitaly process and we are sure it is
- # running locally because it uses a Unix socket.
- def create_gitaly_configuration
+ # only generate a configuration for the most common and simplest case: when
+ # we have exactly one Gitaly process and we are sure it is running locally
+ # because it uses a Unix socket.
+ def gitaly_configuration_toml
storages = []
address = nil
@@ -63,8 +59,12 @@ namespace :gitlab do
storages << { name: key, path: val['path'] }
end
+ TOML.dump(socket_path: address.sub(%r{\Aunix:}, ''), storage: storages)
+ end
+
+ def create_gitaly_configuration
File.open("config.toml", "w") do |f|
- f.puts TOML.dump(socket_path: address.sub(%r{\Aunix:}, ''), storages: storages)
+ f.puts gitaly_configuration_toml
end
rescue ArgumentError => e
puts "Skipping config.toml generation:"