diff options
author | Stan Hu <stanhu@gmail.com> | 2016-07-23 06:35:00 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-07-23 07:14:47 -0700 |
commit | 990af894d329e5577cc9fd4489f0bf3d370e5421 (patch) | |
tree | 3c8072a6b7035fc6afd4f491e8679e84ecb5b0d0 /app | |
parent | 46a17ffd5a200b4d2aca914ef5bafe46db1cb9bf (diff) | |
download | gitlab-ce-990af894d329e5577cc9fd4489f0bf3d370e5421.tar.gz |
Improve project rename log messages for better debuggingimprove-rename-logging
Helping to diagnose #20178
Diffstat (limited to 'app')
-rw-r--r-- | app/models/project.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 5452d9f768f..023b1dc3725 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -882,9 +882,13 @@ class Project < ActiveRecord::Base old_path_with_namespace = File.join(namespace_dir, path_was) new_path_with_namespace = File.join(namespace_dir, path) + Rails.logger.error "Attempting to rename #{old_path_with_namespace} -> #{new_path_with_namespace}" + expire_caches_before_rename(old_path_with_namespace) if has_container_registry_tags? + Rails.logger.error "Project #{old_path_with_namespace} cannot be renamed because container registry tags are present" + # we currently doesn't support renaming repository if it contains tags in container registry raise Exception.new('Project cannot be renamed, because tags are present in its container registry') end @@ -903,17 +907,22 @@ class Project < ActiveRecord::Base SystemHooksService.new.execute_hooks_for(self, :rename) @repository = nil - rescue + rescue => e + Rails.logger.error "Exception renaming #{old_path_with_namespace} -> #{new_path_with_namespace}: #{e}" # Returning false does not rollback after_* transaction but gives # us information about failing some of tasks false end else + Rails.logger.error "Repository could not be renamed: #{old_path_with_namespace} -> #{new_path_with_namespace}" + # if we cannot move namespace directory we should rollback # db changes in order to prevent out of sync between db and fs raise Exception.new('repository cannot be renamed') end + Gitlab::AppLogger.info "Project was renamed: #{old_path_with_namespace} -> #{new_path_with_namespace}" + Gitlab::UploadsTransfer.new.rename_project(path_was, path, namespace.path) end |