Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
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
nexedi
gitlab-shell
Commits
02088137
Commit
02088137
authored
Apr 02, 2019
by
Ash McKenzie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use write_stderr instead of $stderr.puts
parent
3a79ac9d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
lib/action/custom.rb
lib/action/custom.rb
+3
-1
lib/gitlab_shell.rb
lib/gitlab_shell.rb
+7
-4
No files found.
lib/action/custom.rb
View file @
02088137
require
'base64'
require_relative
'../http_helper'
require_relative
'../console_helper'
module
Action
class
Custom
include
HTTPHelper
include
ConsoleHelper
class
BaseError
<
StandardError
;
end
class
MissingPayloadError
<
BaseError
;
end
...
...
@@ -105,7 +107,7 @@ module Action
end
def
format_gitlab_output
(
str
)
str
.
split
(
"
\n
"
).
map
{
|
line
|
"> GitLab:
#{
line
}
"
}
.
join
(
"
\n
"
)
format_for_stderr
(
str
.
split
(
"
\n
"
))
.
join
(
"
\n
"
)
end
def
validate!
...
...
lib/gitlab_shell.rb
View file @
02088137
...
...
@@ -6,8 +6,11 @@ require 'pathname'
require_relative
'gitlab_net'
require_relative
'gitlab_metrics'
require_relative
'action'
require_relative
'console_helper'
class
GitlabShell
# rubocop:disable Metrics/ClassLength
include
ConsoleHelper
class
AccessDeniedError
<
StandardError
;
end
class
DisallowedCommandError
<
StandardError
;
end
class
InvalidRepositoryPathError
<
StandardError
;
end
...
...
@@ -82,18 +85,18 @@ class GitlabShell # rubocop:disable Metrics/ClassLength
true
rescue
GitlabNet
::
ApiUnreachableError
$stderr
.
puts
"GitLab: Failed to authorize your Git request: internal API unreachable"
write_stderr
(
'Failed to authorize your Git request: internal API unreachable'
)
false
rescue
AccessDeniedError
=>
ex
$logger
.
warn
(
'Access denied'
,
command:
origin_cmd
,
user:
log_username
)
$stderr
.
puts
"GitLab:
#{
ex
.
message
}
"
write_stderr
(
ex
.
message
)
false
rescue
DisallowedCommandError
$logger
.
warn
(
'Denied disallowed command'
,
command:
origin_cmd
,
user:
log_username
)
$stderr
.
puts
"GitLab: Disallowed command"
write_stderr
(
'Disallowed command'
)
false
rescue
InvalidRepositoryPathError
$stderr
.
puts
"GitLab: Invalid repository path"
write_stderr
(
'Invalid repository path'
)
false
rescue
Action
::
Custom
::
BaseError
=>
ex
$logger
.
warn
(
'Custom action error'
,
exception:
ex
.
class
,
message:
ex
.
message
,
...
...
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