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
bc285ea5
Commit
bc285ea5
authored
Oct 01, 2020
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Gitlab::ProjectAccess to look up for an error message
parent
ba0277c5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
10 deletions
+17
-10
ee/app/services/geo/design_repository_sync_service.rb
ee/app/services/geo/design_repository_sync_service.rb
+2
-1
ee/app/services/geo/repository_sync_service.rb
ee/app/services/geo/repository_sync_service.rb
+2
-1
ee/app/services/geo/wiki_sync_service.rb
ee/app/services/geo/wiki_sync_service.rb
+2
-1
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+11
-7
No files found.
ee/app/services/geo/design_repository_sync_service.rb
View file @
bc285ea5
...
...
@@ -16,12 +16,13 @@ module Geo
rescue
Gitlab
::
Shell
::
Error
,
Gitlab
::
Git
::
BaseError
=>
e
# In some cases repository does not exist, the only way to know about this is to parse the error text.
# If it does not exist we should consider it as successfully downloaded.
if
e
.
message
.
include?
Gitlab
::
GitAccessDesign
::
ERROR_MESSAGES
[
:no_repo
]
# rubocop:disable Cop/LineBreakAroundConditionalBlock
if
e
.
message
.
include?
Gitlab
::
GitAccessDesign
.
error_message
(
:no_repo
)
log_info
(
'Design repository is not found, marking it as successfully synced'
)
mark_sync_as_successful
(
missing_on_primary:
true
)
else
fail_registry_sync!
(
'Error syncing design repository'
,
e
)
end
ensure
expire_repository_caches
end
...
...
ee/app/services/geo/repository_sync_service.rb
View file @
bc285ea5
...
...
@@ -19,7 +19,7 @@ module Geo
project
.
repository
.
after_create
rescue
Gitlab
::
Shell
::
Error
,
Gitlab
::
Git
::
BaseError
=>
e
# In some cases repository does not exist, the only way to know about this is to parse the error text.
if
e
.
message
.
include?
Gitlab
::
GitAccess
::
ERROR_MESSAGES
[
:no_repo
]
# rubocop:disable Cop/LineBreakAroundConditionalBlock
if
e
.
message
.
include?
(
Gitlab
::
GitAccessProject
.
error_message
(
:no_repo
))
if
repository_presumably_exists_on_primary?
log_info
(
'Repository is not found, but it seems to exist on the primary'
)
fail_registry_sync!
(
'Repository is not found'
,
e
)
...
...
@@ -30,6 +30,7 @@ module Geo
else
fail_registry_sync!
(
'Error syncing repository'
,
e
)
end
ensure
expire_repository_caches
execute_housekeeping
...
...
ee/app/services/geo/wiki_sync_service.rb
View file @
bc285ea5
...
...
@@ -16,7 +16,7 @@ module Geo
rescue
Gitlab
::
Shell
::
Error
,
Gitlab
::
Git
::
BaseError
,
Wiki
::
CouldNotCreateWikiError
=>
e
# In some cases repository does not exist, the only way to know about this is to parse the error text.
# If it does not exist we should consider it as successfully downloaded.
if
e
.
message
.
include?
Gitlab
::
GitAccessWiki
::
ERROR_MESSAGES
[
:no_repo
]
# rubocop:disable Cop/LineBreakAroundConditionalBlock
if
e
.
message
.
include?
(
Gitlab
::
GitAccessWiki
.
error_message
(
:no_repo
))
if
repository_presumably_exists_on_primary?
log_info
(
'Wiki is not found, but it seems to exist on the primary'
)
fail_registry_sync!
(
'Wiki is not found'
,
e
)
...
...
@@ -27,6 +27,7 @@ module Geo
else
fail_registry_sync!
(
'Error syncing wiki repository'
,
e
)
end
ensure
expire_repository_caches
end
...
...
lib/gitlab/git_access.rb
View file @
bc285ea5
...
...
@@ -47,6 +47,16 @@ module Gitlab
:cmd
,
:changes
attr_accessor
:container
def
self
.
error_message
(
key
)
self
.
ancestors
.
each
do
|
cls
|
return
cls
.
const_get
(
'ERROR_MESSAGES'
,
false
).
fetch
(
key
)
rescue
NameError
,
KeyError
next
end
raise
ArgumentError
,
"No error message defined for
#{
key
}
"
end
def
initialize
(
actor
,
container
,
protocol
,
authentication_abilities
:,
namespace_path:
nil
,
repository_path:
nil
,
redirected_path:
nil
,
auth_result_type:
nil
)
@actor
=
actor
@container
=
container
...
...
@@ -413,13 +423,7 @@ module Gitlab
protected
def
error_message
(
key
)
self
.
class
.
ancestors
.
each
do
|
cls
|
return
cls
.
const_get
(
'ERROR_MESSAGES'
,
false
).
fetch
(
key
)
rescue
NameError
,
KeyError
next
end
raise
ArgumentError
,
"No error message defined for
#{
key
}
"
self
.
class
.
error_message
(
key
)
end
def
success_result
...
...
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