繁体   English   中英

在capistrano部署期间如何调试Psych :: SyntaxError?

[英]How to debug Psych::SyntaxError during capistrano deploy?

我的数据库推送停止工作。

这是我的deploy.rb文件: https : deploy.rb

我正在使用'capistrano-db-tasks' 如何调试问题出在哪里?

Are you sure you want to erase your local database with server database (y)es, (n)o  ? y
local {"adapter"=>"mysql2", "encoding"=>"utf8", "database"=>"app-development", "username"=>"root", "password"=>nil, "host"=>"localhost", "port"=>3306}
  * executing "cat /home/app/current/config/database.yml"
    servers: ["213.238.59.107"]
    [213.238.59.107] executing command
    command finished in 345ms
/Users/rege/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/psych.rb:205:in `parse': (<unknown>): mapping values are not allowed in this context at line 1 column 14 (Psych::SyntaxError)
        from /Users/rege/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'
        from /Users/rege/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/psych.rb:153:in `parse'
        from /Users/rege/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/psych.rb:129:in `load'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-db-tasks-0.2/lib/capistrano-db-tasks/database.rb:64:in `initialize'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-db-tasks-0.2/lib/capistrano-db-tasks/database.rb:122:in `new'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-db-tasks-0.2/lib/capistrano-db-tasks/database.rb:122:in `remote_to_local'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-db-tasks-0.2/lib/capistrano-db-tasks/dbtasks.rb:31:in `block (4 levels) in <top (required)>'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-2.15.4/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:89:in `execute_task'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-2.15.4/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-2.15.4/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-2.15.4/lib/capistrano/configuration/namespaces.rb:110:in `block in define_task'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-db-tasks-0.2/lib/capistrano-db-tasks/dbtasks.rb:38:in `block (3 levels) in <top (required)>'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-2.15.4/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:89:in `execute_task'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:46:in `block in execute_requested_actions'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:45:in `each'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:45:in `execute_requested_actions'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-2.15.4/lib/capistrano/cli/help.rb:19:in `execute_requested_actions_with_help'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:34:in `execute!'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:14:in `execute'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/gems/capistrano-2.15.4/bin/cap:4:in `<top (required)>'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/bin/cap:23:in `load'
        from /Users/rege/.rbenv/versions/2.0.0-p247/gemsets/app/bin/cap:23:in `<main>'

问题在于您使用的capistrano-db-tasks Gem。

显然,它读取的配置文件YAML文件格式错误。

Psych是Ruby( https://github.com/tenderlove/psych )附带的YAML解析器,它无法读取您的文件。

本质上,这不是Capistrano问题。

您服务器上/home/app/current/config/database.yml上的文件可能不可读。 您可以尝试通过YAML Lint( http://yamllint.com/ )运行该文件,以检查是否存在错误。

最近(在过去的两年中,大约1.9变得流行),Ruby(又名YARV,CRuby,MRI)从Ruby 2.0 YAML页面切换为YAML解析器:

塞克

Syck是Ruby标准库中YAML实现的原始版本,这是由幸运的人开发的。

如果愿意,仍然可以通过更改YAML::ENGINE来使用Syck,如下所示:

YAML::ENGINE.yamler = 'syck' # switch back to the default Psych YAML::ENGINE.yamler = 'psych'

我将确保您可以在(失败的)部署目录中的rails控制台上读取该文件,并与capistrano-db-tasks gem的供应商联系,这很可能在其他一些YAML文件上失败了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM