diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-02-12 15:16:31 -0800 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-02-12 15:16:31 -0800 |
commit | 2100c3d200a439d92a551915db324ff85cd88c56 (patch) | |
tree | 8f3d7881e39abb6f44c3d337bdd1c6be02ea1885 /lib/gitlab_access.rb | |
parent | 849d8fdc7f0397f77766ff7a66175553d74c72ef (diff) | |
parent | f61186ba00ac1c6e96e4e16d7fe118debcdda1ea (diff) | |
download | gitlab-shell-2100c3d200a439d92a551915db324ff85cd88c56.tar.gz |
Merge branch 'master' into git-annex
Conflicts:
lib/gitlab_shell.rb
Diffstat (limited to 'lib/gitlab_access.rb')
-rw-r--r-- | lib/gitlab_access.rb | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/gitlab_access.rb b/lib/gitlab_access.rb index 547b81d..22343fd 100644 --- a/lib/gitlab_access.rb +++ b/lib/gitlab_access.rb @@ -18,15 +18,20 @@ class GitlabAccess end def exec - status = api.check_access('git-receive-pack', @repo_name, @actor, @changes) - if status.allowed? - true - else - # reset GL_ID env since we stop git push here - ENV['GL_ID'] = nil - puts "GitLab: #{status.message}" - false + begin + status = api.check_access('git-receive-pack', @repo_name, @actor, @changes) + + return true if status.allowed? + + message = status.message + rescue GitlabNet::ApiUnreachableError + message = "Failed to authorize your Git request: internal API unreachable" end + + # reset GL_ID env since we stop git push here + ENV['GL_ID'] = nil + puts "GitLab: #{message}" + false end protected |