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
Jérome Perrin
gitlab-ce
Commits
1a89db5f
Commit
1a89db5f
authored
Feb 12, 2015
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to test settings added in the service.
parent
d899bc91
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
app/controllers/projects/services_controller.rb
app/controllers/projects/services_controller.rb
+1
-1
app/models/project_services/issue_tracker_service.rb
app/models/project_services/issue_tracker_service.rb
+23
-0
No files found.
app/controllers/projects/services_controller.rb
View file @
1a89db5f
...
...
@@ -29,7 +29,7 @@ class Projects::ServicesController < Projects::ApplicationController
if
@service
.
execute
(
data
)
message
=
{
notice:
'We sent a request to the provided URL'
}
else
message
=
{
alert:
'We tried to send a request to the provided URL but error occured'
}
message
=
{
alert:
'We tried to send a request to the provided URL but
an
error occured'
}
end
redirect_to
:back
,
message
...
...
app/models/project_services/issue_tracker_service.rb
View file @
1a89db5f
...
...
@@ -65,6 +65,29 @@ class IssueTrackerService < Service
end
end
def
execute
(
data
)
message
=
"
#{
self
.
type
}
was unable to reach
#{
self
.
project_url
}
. Check the url and try again."
result
=
false
begin
url
=
URI
.
parse
(
self
.
project_url
)
if
url
.
host
&&
url
.
port
http
=
Net
::
HTTP
.
start
(
url
.
host
,
url
.
port
,
{
open_timeout:
5
,
read_timeout:
5
})
response
=
http
.
head
(
"/"
)
if
response
message
=
"
#{
self
.
type
}
received response
#{
response
.
code
}
when attempting to connect to
#{
self
.
project_url
}
"
result
=
true
end
end
rescue
Timeout
::
Error
,
SocketError
,
Errno
::
ECONNRESET
,
Errno
::
ECONNREFUSED
=>
error
message
=
"
#{
self
.
type
}
had an error when trying to connect to
#{
self
.
project_url
}
:
#{
error
.
message
}
"
end
Rails
.
logger
.
info
(
message
)
result
end
private
def
enabled_in_gitlab_config
...
...
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