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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
12be728b
Commit
12be728b
authored
May 02, 2018
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove old GitLab Shell implementation
Moves the calls to Gitaly, no matter what the feature flag values are.
parent
c22a3fa0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
40 deletions
+9
-40
changelogs/unreleased/zj-namespace-service-mandatory.yml
changelogs/unreleased/zj-namespace-service-mandatory.yml
+5
-0
lib/gitlab/shell.rb
lib/gitlab/shell.rb
+4
-40
No files found.
changelogs/unreleased/zj-namespace-service-mandatory.yml
0 → 100644
View file @
12be728b
---
title
:
Finish NamespaceService migration to Gitaly
merge_request
:
author
:
type
:
performance
lib/gitlab/shell.rb
View file @
12be728b
...
...
@@ -294,17 +294,7 @@ module Gitlab
# add_namespace("default", "gitlab")
#
def
add_namespace
(
storage
,
name
)
Gitlab
::
GitalyClient
.
migrate
(
:add_namespace
,
status:
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_OUT
)
do
|
enabled
|
if
enabled
Gitlab
::
GitalyClient
::
NamespaceService
.
new
(
storage
).
add
(
name
)
else
path
=
full_path
(
storage
,
name
)
FileUtils
.
mkdir_p
(
path
,
mode:
0770
)
unless
exists?
(
storage
,
name
)
end
end
rescue
Errno
::
EEXIST
=>
e
Rails
.
logger
.
warn
(
"Directory exists as a file:
#{
e
}
at:
#{
path
}
"
)
Gitlab
::
GitalyClient
::
NamespaceService
.
new
(
storage
).
add
(
name
)
rescue
GRPC
::
InvalidArgument
=>
e
raise
ArgumentError
,
e
.
message
end
...
...
@@ -316,14 +306,7 @@ module Gitlab
# rm_namespace("default", "gitlab")
#
def
rm_namespace
(
storage
,
name
)
Gitlab
::
GitalyClient
.
migrate
(
:remove_namespace
,
status:
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_OUT
)
do
|
enabled
|
if
enabled
Gitlab
::
GitalyClient
::
NamespaceService
.
new
(
storage
).
remove
(
name
)
else
FileUtils
.
rm_r
(
full_path
(
storage
,
name
),
force:
true
)
end
end
Gitlab
::
GitalyClient
::
NamespaceService
.
new
(
storage
).
remove
(
name
)
rescue
GRPC
::
InvalidArgument
=>
e
raise
ArgumentError
,
e
.
message
end
...
...
@@ -335,17 +318,7 @@ module Gitlab
# mv_namespace("/path/to/storage", "gitlab", "gitlabhq")
#
def
mv_namespace
(
storage
,
old_name
,
new_name
)
Gitlab
::
GitalyClient
.
migrate
(
:rename_namespace
,
status:
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_OUT
)
do
|
enabled
|
if
enabled
Gitlab
::
GitalyClient
::
NamespaceService
.
new
(
storage
)
.
rename
(
old_name
,
new_name
)
else
break
false
if
exists?
(
storage
,
new_name
)
||
!
exists?
(
storage
,
old_name
)
FileUtils
.
mv
(
full_path
(
storage
,
old_name
),
full_path
(
storage
,
new_name
))
end
end
Gitlab
::
GitalyClient
::
NamespaceService
.
new
(
storage
).
rename
(
old_name
,
new_name
)
rescue
GRPC
::
InvalidArgument
false
end
...
...
@@ -370,17 +343,8 @@ module Gitlab
# exists?(storage, 'gitlab')
# exists?(storage, 'gitlab/cookies.git')
#
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/385
def
exists?
(
storage
,
dir_name
)
Gitlab
::
GitalyClient
.
migrate
(
:namespace_exists
,
status:
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_OUT
)
do
|
enabled
|
if
enabled
Gitlab
::
GitalyClient
::
NamespaceService
.
new
(
storage
)
.
exists?
(
dir_name
)
else
File
.
exist?
(
full_path
(
storage
,
dir_name
))
end
end
Gitlab
::
GitalyClient
::
NamespaceService
.
new
(
storage
).
exists?
(
dir_name
)
end
protected
...
...
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