21600: set cypress data tag Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox@curii...
[arvados.git] / services / api / script / migrate-gitolite-to-uuid-storage.rb
index 8db1a0edadf4f8707d630d5dc02021501e0724a3..98f25ca5378f5d84ea0f19407fd878c75a8a01f2 100755 (executable)
@@ -1,4 +1,8 @@
 #!/usr/bin/env ruby
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
 #
 # Prior to April 2015, Arvados Gitolite integration stored repositories by
 # name.  To improve user repository management, we switched to storing
@@ -35,8 +39,10 @@ DEBUG = 1
 # load and merge in the environment-specific application config info
 # if present, overriding base config parameters as specified
 path = File.dirname(__FILE__) + '/config/arvados-clients.yml'
-if File.exists?(path) then
-  cp_config = YAML.load_file(path)[ENV['RAILS_ENV']]
+if File.exist?(path) then
+  cp_config = File.open(path) do |f|
+    YAML.safe_load(f, filename: path)[ENV['RAILS_ENV']]
+  end
 else
   puts "Please create a\n " + File.dirname(__FILE__) + "/config/arvados-clients.yml\n file"
   exit 1
@@ -186,7 +192,7 @@ end
 
 begin
   # Get our local gitolite-admin repo up to snuff
-  if not File.exists?(gitolite_admin) then
+  if not File.exist?(gitolite_admin) then
     ensure_directory(gitolite_tmpdir, 0700)
     Dir.chdir(gitolite_tmpdir)
     `git clone #{gitolite_url}`