Update storage location after a project has been transfered

parent 3962c725
...@@ -81,7 +81,7 @@ module Projects ...@@ -81,7 +81,7 @@ module Projects
project.old_path_with_namespace = @old_path project.old_path_with_namespace = @old_path
write_repository_config(@new_path) update_repository_configuration(@new_path)
execute_system_hooks execute_system_hooks
end end
...@@ -106,8 +106,9 @@ module Projects ...@@ -106,8 +106,9 @@ module Projects
project.save! project.save!
end end
def write_repository_config(full_path) def update_repository_configuration(full_path)
project.write_repository_config(gl_full_path: full_path) project.write_repository_config(gl_full_path: full_path)
project.track_project_repository
end end
def refresh_permissions def refresh_permissions
...@@ -123,7 +124,7 @@ module Projects ...@@ -123,7 +124,7 @@ module Projects
rollback_folder_move rollback_folder_move
project.reload project.reload
update_namespace_and_visibility(@old_namespace) update_namespace_and_visibility(@old_namespace)
write_repository_config(@old_path) update_repository_configuration(@old_path)
end end
def rollback_folder_move def rollback_folder_move
......
...@@ -63,6 +63,15 @@ describe Projects::TransferService do ...@@ -63,6 +63,15 @@ describe Projects::TransferService do
expect(rugged_config['gitlab.fullpath']).to eq "#{group.full_path}/#{project.path}" expect(rugged_config['gitlab.fullpath']).to eq "#{group.full_path}/#{project.path}"
end end
it 'updates storage location' do
transfer_project(project, user, group)
expect(project.project_repository).to have_attributes(
disk_path: "#{group.full_path}/#{project.path}",
shard_name: project.repository_storage
)
end
context 'new group has a kubernetes cluster' do context 'new group has a kubernetes cluster' do
let(:group_cluster) { create(:cluster, :group, :provided_by_gcp) } let(:group_cluster) { create(:cluster, :group, :provided_by_gcp) }
let(:group) { group_cluster.group } let(:group) { group_cluster.group }
...@@ -139,6 +148,17 @@ describe Projects::TransferService do ...@@ -139,6 +148,17 @@ describe Projects::TransferService do
expect(service).not_to receive(:execute_system_hooks) expect(service).not_to receive(:execute_system_hooks)
end end
end end
it 'does not update storage location' do
create(:project_repository, project: project)
attempt_project_transfer
expect(project.project_repository).to have_attributes(
disk_path: project.disk_path,
shard_name: project.repository_storage
)
end
end end
context 'namespace -> no namespace' do context 'namespace -> no namespace' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment