From 91f10513ef5542ec1b50cbad3aa4c8c3da0a46e8 Mon Sep 17 00:00:00 2001 From: Artem Yegorov Date: Wed, 13 Mar 2024 10:41:17 +0300 Subject: [PATCH] Add `aliases: true` in YAML.load Original error: ~/.rvm/gems/ruby-3.0.4/gems/psych-5.1.2/lib/psych/visitors/to_ruby.rb:432:in `visit_Psych_Nodes_Alias': Alias parsing was not enabled. To enable it, pass `aliases: true` to `Psych::load` or `Psych::safe_load`. (Psych::AliasesNotEnabled) --- lib/cloner/ar.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cloner/ar.rb b/lib/cloner/ar.rb index 8d2f8ed..9897d26 100644 --- a/lib/cloner/ar.rb +++ b/lib/cloner/ar.rb @@ -1,7 +1,7 @@ module Cloner::Ar def read_ar_conf @conf ||= begin - YAML.load(ERB.new(File.read(Rails.root.join('config', 'database.yml'))).result)[env_database] + YAML.load(ERB.new(File.read(Rails.root.join('config', 'database.yml'))).result, aliases: true)[env_database] end end def ar_conf @@ -35,7 +35,7 @@ def read_ar_r_conf ret = ssh_exec!(ssh, "cat #{e(remote_app_path + '/config/database.yml')}") check_ssh_err(ret) begin - res = YAML.load(ERB.new(ret[0]).result)[env_from] + res = YAML.load(ERB.new(ret[0]).result, aliases: true)[env_from] raise 'no data' if res.blank? #res['host'] ||= '127.0.0.1' rescue Exception => e