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
150aee0e
Commit
150aee0e
authored
Jul 15, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add license fingerprint and catch errors in HTTParty
parent
3d4fce06
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
6 deletions
+12
-6
app/views/admin/application_settings/_form.html.haml
app/views/admin/application_settings/_form.html.haml
+1
-1
app/workers/gitlab_usage_ping_worker.rb
app/workers/gitlab_usage_ping_worker.rb
+9
-4
db/schema.rb
db/schema.rb
+1
-1
spec/workers/gitlab_usage_ping_worker_spec.rb
spec/workers/gitlab_usage_ping_worker_spec.rb
+1
-0
No files found.
app/views/admin/application_settings/_form.html.haml
View file @
150aee0e
...
...
@@ -62,7 +62,7 @@
=
f
.
check_box
:usage_ping_enabled
Usage ping enabled
.help-block
Every week GitLab will report license usage back to
a GitLab server
.
Every week GitLab will report license usage back to
GitLab, Inc
.
Disable this option if you do not want this to occur.
.form-group
.col-sm-offset-2.col-sm-10
...
...
app/workers/gitlab_usage_ping_worker.rb
View file @
150aee0e
...
...
@@ -14,10 +14,14 @@ class GitlabUsagePingWorker
# Multiple Sidekiq workers could run this. We should only do this at most once a day.
return
unless
try_obtain_lease
begin
HTTParty
.
post
(
url
,
body:
data
.
to_json
,
headers:
{
'Content-type'
=>
'application/json'
}
)
rescue
HTTParty
::
Error
=>
e
Rails
.
logger
.
info
"Unable to contact GitLab, Inc.:
#{
e
}
"
end
end
def
try_obtain_lease
...
...
@@ -30,6 +34,7 @@ class GitlabUsagePingWorker
license
=
License
.
current
if
license
usage_data
[
:license_md5
]
=
Digest
::
MD5
.
hexdigest
(
license
.
data
)
usage_data
[
:historical_max_users
]
=
max_historical_user_count
usage_data
[
:licensee
]
=
license
.
licensee
usage_data
[
:license_user_count
]
=
license
.
user_count
...
...
db/schema.rb
View file @
150aee0e
...
...
@@ -94,7 +94,7 @@ ActiveRecord::Schema.define(version: 20160713222618) do
t
.
string
"elasticsearch_host"
,
default:
"localhost"
t
.
string
"elasticsearch_port"
,
default:
"9200"
t
.
string
"repository_storage"
,
default:
"default"
t
.
string
"enabled_git_access_protocol"
,
t
.
string
"enabled_git_access_protocol"
t
.
boolean
"usage_ping_enabled"
,
default:
true
,
null:
false
end
...
...
spec/workers/gitlab_usage_ping_worker_spec.rb
View file @
150aee0e
...
...
@@ -7,6 +7,7 @@ describe GitlabUsagePingWorker do
data
=
subject
.
data
license
=
License
.
current
expect
(
data
[
:license_md5
]).
to
eq
(
Digest
::
MD5
.
hexdigest
(
license
.
data
))
expect
(
data
[
:version
]).
to
eq
(
Gitlab
::
VERSION
)
expect
(
data
[
:licensee
]).
to
eq
(
license
.
licensee
)
expect
(
data
[
:active_users
]).
to
eq
(
User
.
active
.
count
)
...
...
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