Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
636c5923
Commit
636c5923
authored
Jul 01, 2016
by
Alejandro Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix multiple repository storage paths after CE merge
parent
eaa5507e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
39 deletions
+23
-39
app/models/application_setting.rb
app/models/application_setting.rb
+2
-2
app/models/namespace.rb
app/models/namespace.rb
+1
-17
spec/models/project_spec.rb
spec/models/project_spec.rb
+1
-1
spec/tasks/gitlab/backup_rake_spec.rb
spec/tasks/gitlab/backup_rake_spec.rb
+19
-19
No files found.
app/models/application_setting.rb
View file @
636c5923
...
@@ -62,7 +62,7 @@ class ApplicationSetting < ActiveRecord::Base
...
@@ -62,7 +62,7 @@ class ApplicationSetting < ActiveRecord::Base
validates
:elasticsearch_port
,
validates
:elasticsearch_port
,
presence:
{
message:
"can't be blank when indexing is enabled"
},
presence:
{
message:
"can't be blank when indexing is enabled"
},
if: :elasticsearch_indexing?
if: :elasticsearch_indexing?
validates
:repository_storage
,
validates
:repository_storage
,
presence:
true
,
presence:
true
,
inclusion:
{
in:
->
(
_object
)
{
Gitlab
.
config
.
repositories
.
storages
.
keys
}
}
inclusion:
{
in:
->
(
_object
)
{
Gitlab
.
config
.
repositories
.
storages
.
keys
}
}
...
@@ -147,7 +147,7 @@ class ApplicationSetting < ActiveRecord::Base
...
@@ -147,7 +147,7 @@ class ApplicationSetting < ActiveRecord::Base
send_user_confirmation_email:
false
,
send_user_confirmation_email:
false
,
container_registry_token_expire_delay:
5
,
container_registry_token_expire_delay:
5
,
elasticsearch_host:
ENV
[
'ELASTIC_HOST'
]
||
'localhost'
,
elasticsearch_host:
ENV
[
'ELASTIC_HOST'
]
||
'localhost'
,
elasticsearch_port:
ENV
[
'ELASTIC_PORT'
]
||
'9200'
elasticsearch_port:
ENV
[
'ELASTIC_PORT'
]
||
'9200'
,
repository_storage:
'default'
,
repository_storage:
'default'
,
)
)
end
end
...
...
app/models/namespace.rb
View file @
636c5923
...
@@ -94,22 +94,6 @@ class Namespace < ActiveRecord::Base
...
@@ -94,22 +94,6 @@ class Namespace < ActiveRecord::Base
raise
Exception
.
new
(
'Namespace cannot be moved, because at least one project has tags in container registry'
)
raise
Exception
.
new
(
'Namespace cannot be moved, because at least one project has tags in container registry'
)
end
end
<<<<<<<
HEAD
if
gitlab_shell
.
mv_namespace
(
path_was
,
path
)
Gitlab
::
UploadsTransfer
.
new
.
rename_namespace
(
path_was
,
path
)
Gitlab
::
PagesTransfer
.
new
.
rename_namespace
(
path_was
,
path
)
# If repositories moved successfully we need to
# send update instructions to users.
# However we cannot allow rollback since we moved namespace dir
# So we basically we mute exceptions in next actions
begin
send_update_instructions
rescue
# Returning false does not rollback after_* transaction but gives
# us information about failing some of tasks
false
=======
# Move the namespace directory in all storages paths used by member projects
# Move the namespace directory in all storages paths used by member projects
repository_storage_paths
.
each
do
|
repository_storage_path
|
repository_storage_paths
.
each
do
|
repository_storage_path
|
# Ensure old directory exists before moving it
# Ensure old directory exists before moving it
...
@@ -119,11 +103,11 @@ class Namespace < ActiveRecord::Base
...
@@ -119,11 +103,11 @@ class Namespace < ActiveRecord::Base
# if we cannot move namespace directory we should rollback
# if we cannot move namespace directory we should rollback
# db changes in order to prevent out of sync between db and fs
# db changes in order to prevent out of sync between db and fs
raise
Exception
.
new
(
'namespace directory cannot be moved'
)
raise
Exception
.
new
(
'namespace directory cannot be moved'
)
>>>>>>>
557
ca2b31ff503b36a4b65af2641fcd0f5682d5b
end
end
end
end
Gitlab
::
UploadsTransfer
.
new
.
rename_namespace
(
path_was
,
path
)
Gitlab
::
UploadsTransfer
.
new
.
rename_namespace
(
path_was
,
path
)
Gitlab
::
PagesTransfer
.
new
.
rename_namespace
(
path_was
,
path
)
# If repositories moved successfully we need to
# If repositories moved successfully we need to
# send update instructions to users.
# send update instructions to users.
...
...
spec/models/project_spec.rb
View file @
636c5923
...
@@ -1106,7 +1106,7 @@ describe Project, models: true do
...
@@ -1106,7 +1106,7 @@ describe Project, models: true do
let
(
:mirror
)
{
false
}
let
(
:mirror
)
{
false
}
before
do
before
do
allow_any_instance_of
(
Gitlab
::
Shell
).
to
receive
(
:import_repository
).
with
(
project
.
path_with_namespace
,
project
.
import_url
).
and_return
(
true
)
allow_any_instance_of
(
Gitlab
::
Shell
).
to
receive
(
:import_repository
).
with
(
project
.
repository_storage_path
,
project
.
path_with_namespace
,
project
.
import_url
).
and_return
(
true
)
allow
(
project
).
to
receive
(
:repository_exists?
).
and_return
(
true
)
allow
(
project
).
to
receive
(
:repository_exists?
).
and_return
(
true
)
end
end
...
...
spec/tasks/gitlab/backup_rake_spec.rb
View file @
636c5923
...
@@ -129,26 +129,26 @@ describe 'gitlab:app namespace rake task' do
...
@@ -129,26 +129,26 @@ describe 'gitlab:app namespace rake task' do
end
end
end
end
it
'should set correct permissions on the tar contents'
do
it
'should set correct permissions on the tar contents'
do
tar_contents
,
exit_status
=
Gitlab
::
Popen
.
popen
(
tar_contents
,
exit_status
=
Gitlab
::
Popen
.
popen
(
%W{tar -tvf
#{
@backup_tar
}
db uploads.tar.gz repositories builds.tar.gz artifacts.tar.gz pages.tar.gz lfs.tar.gz registry.tar.gz}
%W{tar -tvf
#{
@backup_tar
}
db uploads.tar.gz repositories builds.tar.gz artifacts.tar.gz pages.tar.gz lfs.tar.gz registry.tar.gz}
)
)
expect
(
exit_status
).
to
eq
(
0
)
expect
(
exit_status
).
to
eq
(
0
)
expect
(
tar_contents
).
to
match
(
'db/'
)
expect
(
tar_contents
).
to
match
(
'db/'
)
expect
(
tar_contents
).
to
match
(
'uploads.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'uploads.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'repositories/'
)
expect
(
tar_contents
).
to
match
(
'repositories/'
)
expect
(
tar_contents
).
to
match
(
'builds.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'builds.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'artifacts.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'artifacts.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'pages.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'pages.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'lfs.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'lfs.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'registry.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'registry.tar.gz'
)
expect
(
tar_contents
).
not_to
match
(
/^.{4,9}[rwx].* (database.sql.gz|uploads.tar.gz|repositories|builds.tar.gz|pages.tar.gz|artifacts.tar.gz|registry.tar.gz)\/$/
)
expect
(
tar_contents
).
not_to
match
(
/^.{4,9}[rwx].* (database.sql.gz|uploads.tar.gz|repositories|builds.tar.gz|pages.tar.gz|artifacts.tar.gz|registry.tar.gz)\/$/
)
end
end
it
'should delete temp directories'
do
it
'should delete temp directories'
do
temp_dirs
=
Dir
.
glob
(
temp_dirs
=
Dir
.
glob
(
File
.
join
(
Gitlab
.
config
.
backup
.
path
,
'{db,repositories,uploads,builds,artifacts,pages,lfs,registry}'
)
File
.
join
(
Gitlab
.
config
.
backup
.
path
,
'{db,repositories,uploads,builds,artifacts,pages,lfs,registry}'
)
)
)
expect
(
temp_dirs
).
to
be_empty
expect
(
temp_dirs
).
to
be_empty
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment