首页 文章

从svn失败的Capistrano部署

提问于
浏览
0

我正在尝试使用capistrano 2将我的应用程序从subversion部署到本地服务器 . 这是我试图部署的代码,它只是默认的rails应用程序:

https://www.assembla.com/code/capistranotest/subversion/nodes

这是我的deploy.rb文件,它指向我的svn repo:

set :application, "CapistranoTest"
set :user, "jack"
set :repository,  "https://subversion.assembla.com/svn/capistranotest/"

set :scm, :subversion

set :deploy_to, "/home/jaeren/capistranotest"

role :web, "192.168.169.129"
role :app, "192.168.169.129"
role :db,  "192.168.169.129", :primary => true

set :scm_username, "jack"
set :runner, "jack"

set :use_sudo, false

我的上限部署:安装程序工作并创建必要的文件夹 . 但是当我运行cap deploy:cold并在提示我的assembla帐户时输入我的用户名和密码我得到了这个错误 . 谁能告诉我为什么?

Jacks-MacBook-Pro:capistranotest Jack$ cd trunk
Jacks-MacBook-Pro:trunk Jack$ cap deploy:cold
  * 2015-04-27 00:31:45 executing `deploy:cold'
  * 2015-04-27 00:31:45 executing `deploy:update'
 ** transaction: start
  * 2015-04-27 00:31:45 executing `deploy:update_code'
    executing locally: "svn info https://subversion.assembla.com/svn/capistranotest/ --username \"jack\"--password \"\"--no-auth-cache  -rHEAD"
Authentication realm: <https://subversion.assembla.com:443> Assembla Restricted Area
Password for 'jack--password': *************************

Authentication realm: <https://subversion.assembla.com:443> Assembla Restricted Area
Username: jack
Password for 'jack': *************************

    command finished in 53369ms
  * executing "svn checkout -q --username \"jack\"--password \"\"--no-auth-cache  -r6 https://subversion.assembla.com/svn/capistranotest/ /home/jack/capistranotest/releases/20150426233238 && (echo 6 > /home/jack/capistranotest/releases/20150426233238/REVISION)"
    servers: ["192.168.169.129"]
    [192.168.169.129] executing command
 ** [192.168.169.129 :: err] Authentication realm: <https://subversion.assembla.com:443> Assembla Restricted Area
 ** [192.168.169.129 :: err] Password for 'jack--password':
Password: 
 ** [192.168.169.129 :: err] Authentication realm: <https://subversion.assembla.com:443> Assembla Restricted Area
 ** [192.168.169.129 :: err] Username:
  • 编辑 -

尝试更改为capistrano 2.12.0,它输出不同的命令,但我仍然得到相同的错误:

Jaerens-MacBook-Pro:trunk Jaeren$ cap deploy:cold
  * executing `deploy:cold'
  * executing `deploy:update'
 ** transaction: start
  * executing `deploy:update_code'
    executing locally: "svn info https://subversion.assembla.com/svn/capistranotest/ --username jaeren --password  --no-auth-cache  -rHEAD"
Authentication realm: <https://subversion.assembla.com:443> Assembla Restricted Area
Username: Jaeren
Password for 'Jaeren': ***********

    command finished in 8473ms
  * executing "svn checkout -q --username jaeren --password  --no-auth-cache  -r6 https://subversion.assembla.com/svn/capistranotest/ /home/jaeren/capistranotest/releases/20150427001157 && (echo 6 > /home/jaeren/capistranotest/releases/20150427001157/REVISION)"
    servers: ["192.168.169.129"]
    [192.168.169.129] executing command
 ** [192.168.169.129 :: err] Authentication realm: <https://subversion.assembla.com:443> Assembla Restricted Area
 ** [192.168.169.129 :: err] Username:

谢谢 .

2 回答

  • 0

    看起来它正在尝试进行身份验证 jack--password ,因为此处的用户名和其后面的 --password 选项之间没有空格 .

    executing locally: "svn info https://subversion.assembla.com/svn/capistranotest/ --username \"jack\"--password \"\"--no-auth-cache  -rHEAD"
    

    我怀疑这是执行该命令的任何错误,这可能是Capistrano的内置 . 尝试升级到最新的Capistrano然后如果这不能解决问题,请在Capistrano项目上提交GitHub问题 .

  • 0

    Ryan Bigg是对的 . Capistrano用于登录远程SVN存储库的SVN身份验证任务中存在错误 .

    我正在运行Capistrano版本2.15.6,并且该文件的路径位于

    capistrano-YOURVERSION/lib/capistrano/recipes/deploy/scm/subversion.rb
    

    打开此文件进行编辑,然后在底部查找身份验证定义块 .

    def authentication
        username = variable(:scm_username)
        return "" unless username
        result = %(--username "#{variable(:scm_username)}")
        result << %(--password "#{variable(:scm_password)}") unless variable(:scm_auth_cache) || variable(:scm_prefer_prompt)
        result << "--no-auth-cache " unless variable(:scm_auth_cache)
        result
    end
    

    注意缺少空格,其中--password和--no-auth-cache被连接到结果变量 . 我只是在这里添加了一个空格

    def authentication
        username = variable(:scm_username)
        return "" unless username
        result = %(--username "#{variable(:scm_username)}")
        result << %( --password "#{variable(:scm_password)}") unless variable(:scm_auth_cache) || variable(:scm_prefer_prompt)
        result << " --no-auth-cache " unless variable(:scm_auth_cache)
        result
    end
    

    在检查存储库时,可能不会提示OP提供SVN凭据,因为他们已经为SSH用户保存了密码 . Capistrano接受SCM凭证,因此在部署期间无需提示用户使用它们 . 您之所以看到提示输入详细信息的原因是因为上面的代码中没有额外的空白区域,它会向服务器看起来好像Capistrano尝试在不发送密码的情况下进行身份验证 .

相关问题