And you've hit exactly what I warned you about; and it wont likely be your 
last. 

On Jun 12, 2012, at 8:03 AM, shrinath_m2 <cool.shr...@gmail.com> wrote:

> OK, now I am stuck in something interesting...
> 
> My logic to achieve the above said requirement is as follows: 
> 
> You call "cap -S config=blah -S svn-repo=both my_deploy"
> 
> The code in deploy.rb is as such: 
> 
>   
> task :my_deploy do                                                            
>   init_server_list { deploy.default }                                         
> end
> 
> def init_server_list(&given_task)
> 
>   # if svn repo name is given, get ip from there. 
>   if variables.include?(:svn_repo) and svn_repo == "both"
>     # get all repo names, call deployer for every unique name.  
>     con = Mysql.new(db_host, db_user, db_pass, db_schema)
>     rs = con.query("SELECT DISTINCT _nick_name FROM repo;")
>     rs.each do |row|
>       set :repo_name, row[0]
>       get_server_list given_task
>     end
>     con.close
>   end
> end
> 
> 
> def get_server_list(action)
>   con = Mysql.new(db_host, db_user, db_pass, db_schema)
>   query = "select 
>           server.`_ip` as ip,
>           repo.`_svn_url` as repo_url
>         from
>           server 
>           left join repo
>             on repo.`_id` = server.`_repo_id`
>         where repo.`_nick_name` = '#{repo_name}'";
> 
>   rs = con.query(query)                                                      
>   roles[:app].clear
> 
>   rs.each do |row|
>     role :app, row[0]
>     set :repository, row[1]
>   end
>   con.close
>   action.call
> end
> 
> # Unnecessary code removed and/or obfuscated, but assure that no harm done to 
> hinder debugging. 
> 
> Now the logic is that it should loop through for every repository, get the 
> list of servers to be updated for that repository and update the code. 
> All is well, it runs smoothly for every server and all... But...
> When it comes to updating the svn repo, it is pushing the same repo that it 
> got first time. 
> It seemed that the "svn checkout" command is cached somewhere...
> 
> Further debugging, I went into "strategy/checkout.rb" inside capistrano's 
> code. 
> 
> def command
>   @command || = source.checkout(revision, configuration[:release_path])
> end
> 
> Remove the '||' there, it works well... I wouldn't like to touch original 
> capistrano code unless absolutely necessary. So, is there a way to unset the 
> command variable from my recipe or any better way? 
> Any suggestions towards the architecture or a solution would be welcome... 
> 
> 
> 
> On Tuesday, June 12, 2012 2:20:46 PM UTC+5:30, shrinath_m2 wrote:
> 
> 
> On Tue, Jun 12, 2012 at 10:47 AM, Donovan Bray <donno...@gmail.com> wrote:
> with a clean ruby process. 
> That exactly is my problem - I am passing few custom variables - like "cap -S 
> config=myconf -S svn_repo=staging -S restart_bin=httpserver task_a" 
> Now, if I do as you say, I'll have to pass them all over again, which will 
> re-initiate the whole bootstrapping... Bad, isn't it? That requires lot more 
> re-structuring...
> 
> BTW, what might not work with the accepted approach - deploy.default? 
> 
> 
> 
> -- 
> Regards
> Shrinath M
> 
> -- 
> * You received this message because you are subscribed to the Google Groups 
> "Capistrano" group.
> * To post to this group, send email to capistrano@googlegroups.com
> * To unsubscribe from this group, send email to 
> capistrano+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/capistrano?hl=en

-- 
* You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
* To post to this group, send email to capistrano@googlegroups.com
* To unsubscribe from this group, send email to 
capistrano+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/capistrano?hl=en

Reply via email to