[5-4-stable to 6-0-stable]: rake migrate_global_projects fails when owner namespace does not exist
Created by: Zsub
When migrating 5-4-stable to 6-0-stable and choosing to automatically migrate all repositories to their owner's namespace, the migration fails if the owner's namespace doesn't yet exist.
I suspect I may have a corner case here as I'm using the root-user. Still, after manually creating the directory and setting identical permissions to the other directories, the rake task completes successfully.
A possible solution may be to alert the user that a namespace directory does not exist yet and ask if it is OK to create?
git@host:~/gitlab$ bundle exec rake migrate_global_projects RAILS_ENV=production
Global namespace is deprecated. We found 5 projects stored in global namespace
You may abort this task and move them to group/user namespaces manually.
If you want us to move this projects under owner namespaces then continue
Do you want to continue (yes/no)? yes
2013-09-03T19:30:37Z 30147 TID-4i29w INFO: Sidekiq client using unix:///var/run/redis/redis.sock with options {:namespace=>"resque:gitlab"}
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/fileutils.rb:519:in `rename': No such file or directory - (/home/git/repositories/puppet-module-common.git, /home/git/repositories/root/puppet-module-common.git) (Errno::ENOENT)
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/fileutils.rb:519:in `block in mv'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/fileutils.rb:1515:in `block in fu_each_src_dest'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/fileutils.rb:1531:in `fu_each_src_dest0'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/fileutils.rb:1513:in `fu_each_src_dest'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/fileutils.rb:508:in `mv'
from /home/git/gitlab-shell/lib/gitlab_projects.rb:130:in `mv_project'
from /home/git/gitlab-shell/lib/gitlab_projects.rb:35:in `exec'
from /home/git/gitlab-shell/bin/gitlab-projects:25:in `<main>'
Cannot move project