Commit 5613e1b2 authored by Nick Thomas's avatar Nick Thomas

Merge remote-tracking branch 'upstream/master' into ce-to-ee-2017-07-06

parents bb0884b0 b339a870
......@@ -395,6 +395,9 @@ gem 'health_check', '~> 2.6.0'
gem 'vmstat', '~> 2.3.0'
gem 'sys-filesystem', '~> 1.1.6'
# NTP client
gem 'net-ntp'
# Gitaly GRPC client
gem 'gitaly', '~> 0.9.0'
......
......@@ -503,6 +503,7 @@ GEM
mustermann (= 0.4.0)
mysql2 (0.4.5)
net-ldap (0.12.1)
net-ntp (2.1.3)
net-ssh (3.0.1)
netrc (0.11.0)
nokogiri (1.6.8.1)
......@@ -1053,6 +1054,7 @@ DEPENDENCIES
mousetrap-rails (~> 1.4.6)
mysql2 (~> 0.4.5)
net-ldap
net-ntp
net-ssh (~> 3.0.1)
nokogiri (~> 1.6.7, >= 1.6.7.2)
oauth2 (~> 1.4)
......
......@@ -45,7 +45,7 @@ class Projects::PathLocksController < Projects::ApplicationController
private
def check_license
unless @project.feature_available?(:file_lock)
unless @project.feature_available?(:file_locks)
flash[:alert] = 'You need a different license to enable FileLocks feature'
redirect_to admin_license_path
end
......
......@@ -52,7 +52,7 @@ class Projects::RefsController < Projects::ApplicationController
contents.push(*tree.blobs)
contents.push(*tree.submodules)
show_path_locks = @project.feature_available?(:file_lock) && @project.path_locks.any?
show_path_locks = @project.feature_available?(:file_locks) && @project.path_locks.any?
@logs = contents[@offset, @limit].to_a.map do |content|
file = @path ? File.join(@path, content.name) : content.name
......
......@@ -109,7 +109,7 @@ module TreeHelper
end
def lock_file_link(project = @project, path = @path, html_options: {})
return unless project.feature_available?(:file_lock) && current_user
return unless project.feature_available?(:file_locks) && current_user
return if path.blank?
path_lock = project.find_path_lock(path, downstream: true)
......@@ -169,7 +169,7 @@ module TreeHelper
end
def render_lock_icon(path)
return unless @project.feature_available?(:file_lock)
return unless @project.feature_available?(:file_locks)
return unless @project.root_ref?(@ref)
if file_lock = @project.find_path_lock(path, exact_match: true)
......
......@@ -2,18 +2,18 @@ class License < ActiveRecord::Base
include ActionView::Helpers::NumberHelper
AUDITOR_USER_FEATURE = 'GitLab_Auditor_User'.freeze
BURNDOWN_CHARTS_FEATURE = 'BurndownCharts'.freeze
CONTRIBUTION_ANALYTICS_FEATURE = 'ContributionAnalytics'.freeze
BURNDOWN_CHARTS_FEATURE = 'GitLab_BurndownCharts'.freeze
CONTRIBUTION_ANALYTICS_FEATURE = 'GitLab_ContributionAnalytics'.freeze
DEPLOY_BOARD_FEATURE = 'GitLab_DeployBoard'.freeze
ELASTIC_SEARCH_FEATURE = 'GitLab_ElasticSearch'.freeze
EXPORT_ISSUES_FEATURE = 'GitLab_ExportIssues'.freeze
FAST_FORWARD_MERGE_FEATURE = 'GitLab_FastForwardMerge'.freeze
FILE_LOCK_FEATURE = 'GitLab_FileLocks'.freeze
FILE_LOCKS_FEATURE = 'GitLab_FileLocks'.freeze
GEO_FEATURE = 'GitLab_Geo'.freeze
GROUP_WEBHOOKS_FEATURE = 'GroupWebhooks'.freeze
GROUP_WEBHOOKS_FEATURE = 'GitLab_GroupWebhooks'.freeze
ISSUABLE_DEFAULT_TEMPLATES_FEATURE = 'GitLab_IssuableDefaultTemplates'.freeze
ISSUE_BOARDS_FOCUS_MODE_FEATURE = 'IssueBoardsFocusMode'.freeze
ISSUE_BOARD_MILESTONE_FEATURE = 'IssueBoardMilestone'.freeze
ISSUE_BOARD_FOCUS_MODE_FEATURE = 'GitLab_IssueBoardFocusMode'.freeze
ISSUE_BOARD_MILESTONE_FEATURE = 'GitLab_IssueBoardMilestone'.freeze
ISSUE_WEIGHTS_FEATURE = 'GitLab_IssueWeights'.freeze
MERGE_REQUEST_APPROVERS_FEATURE = 'GitLab_MergeRequestApprovers'.freeze
MERGE_REQUEST_REBASE_FEATURE = 'GitLab_MergeRequestRebase'.freeze
......@@ -21,9 +21,9 @@ class License < ActiveRecord::Base
MULTIPLE_ISSUE_ASSIGNEES_FEATURE = 'GitLab_MultipleIssueAssignees'.freeze
OBJECT_STORAGE_FEATURE = 'GitLab_ObjectStorage'.freeze
PUSH_RULES_FEATURE = 'GitLab_PushRules'.freeze
RELATED_ISSUES_FEATURE = 'RelatedIssues'.freeze
RELATED_ISSUES_FEATURE = 'GitLab_RelatedIssues'.freeze
SERVICE_DESK_FEATURE = 'GitLab_ServiceDesk'.freeze
VARIABLE_ENVIRONMENT_SCOPE_FEATURE = 'VariableEnvironmentScope'.freeze
VARIABLE_ENVIRONMENT_SCOPE_FEATURE = 'GitLab_VariableEnvironmentScope'.freeze
FEATURE_CODES = {
auditor_user: AUDITOR_USER_FEATURE,
......@@ -40,10 +40,10 @@ class License < ActiveRecord::Base
deploy_board: DEPLOY_BOARD_FEATURE,
export_issues: EXPORT_ISSUES_FEATURE,
fast_forward_merge: FAST_FORWARD_MERGE_FEATURE,
file_lock: FILE_LOCK_FEATURE,
file_locks: FILE_LOCKS_FEATURE,
group_webhooks: GROUP_WEBHOOKS_FEATURE,
issuable_default_templates: ISSUABLE_DEFAULT_TEMPLATES_FEATURE,
issue_board_focus_mode: ISSUE_BOARDS_FOCUS_MODE_FEATURE,
issue_board_focus_mode: ISSUE_BOARD_FOCUS_MODE_FEATURE,
issue_board_milestone: ISSUE_BOARD_MILESTONE_FEATURE,
issue_weights: ISSUE_WEIGHTS_FEATURE,
merge_request_approvers: MERGE_REQUEST_APPROVERS_FEATURE,
......@@ -66,7 +66,7 @@ class License < ActiveRecord::Base
{ FAST_FORWARD_MERGE_FEATURE => 1 },
{ GROUP_WEBHOOKS_FEATURE => 1 },
{ ISSUABLE_DEFAULT_TEMPLATES_FEATURE => 1 },
{ ISSUE_BOARDS_FOCUS_MODE_FEATURE => 1 },
{ ISSUE_BOARD_FOCUS_MODE_FEATURE => 1 },
{ ISSUE_BOARD_MILESTONE_FEATURE => 1 },
{ ISSUE_WEIGHTS_FEATURE => 1 },
{ MERGE_REQUEST_APPROVERS_FEATURE => 1 },
......@@ -81,7 +81,7 @@ class License < ActiveRecord::Base
*EES_FEATURES,
{ AUDITOR_USER_FEATURE => 1 },
{ DEPLOY_BOARD_FEATURE => 1 },
{ FILE_LOCK_FEATURE => 1 },
{ FILE_LOCKS_FEATURE => 1 },
{ GEO_FEATURE => 1 },
{ OBJECT_STORAGE_FEATURE => 1 },
{ SERVICE_DESK_FEATURE => 1 },
......@@ -106,11 +106,11 @@ class License < ActiveRecord::Base
{ DEPLOY_BOARD_FEATURE => 1 },
{ EXPORT_ISSUES_FEATURE => 1 },
{ FAST_FORWARD_MERGE_FEATURE => 1 },
{ FILE_LOCK_FEATURE => 1 },
{ FILE_LOCKS_FEATURE => 1 },
{ GEO_FEATURE => 1 },
{ GROUP_WEBHOOKS_FEATURE => 1 },
{ ISSUABLE_DEFAULT_TEMPLATES_FEATURE => 1 },
{ ISSUE_BOARDS_FOCUS_MODE_FEATURE => 1 },
{ ISSUE_BOARD_FOCUS_MODE_FEATURE => 1 },
{ ISSUE_BOARD_MILESTONE_FEATURE => 1 },
{ ISSUE_WEIGHTS_FEATURE => 1 },
{ MERGE_REQUEST_APPROVERS_FEATURE => 1 },
......
......@@ -20,7 +20,7 @@
= render 'projects/fork_suggestion'
- if @project.feature_available?(:file_lock)
- if @project.feature_available?(:file_locks)
:javascript
PathLocks.init(
'#{toggle_project_path_locks_path(@project)}',
......
......@@ -35,7 +35,7 @@
= link_to charts_project_graph_path(@project, current_ref) do
#{ _('Charts') }
- if @project.feature_available?(:file_lock)
- if @project.feature_available?(:file_locks)
= nav_link(controller: [:path_locks]) do
= link_to project_path_locks_path(@project) do
Locked Files
......@@ -23,7 +23,7 @@
= render 'projects/blob/upload', title: _('Upload New File'), placeholder: _('Upload New File'), button_title: _('Upload file'), form_path: project_create_blob_path(@project, @id), method: :post
= render 'projects/blob/new_dir'
- if @project.feature_available?(:file_lock)
- if @project.feature_available?(:file_locks)
:javascript
PathLocks.init(
'#{toggle_project_path_locks_path(@project)}',
......
---
title: 'Geo: Added extra SystemCheck checks'
merge_request: 2354
author:
......@@ -248,7 +248,7 @@ module Gitlab
end
def validate_path_locks?
@validate_path_locks ||= @project.feature_available?(:file_lock) &&
@validate_path_locks ||= @project.feature_available?(:file_locks) &&
project.path_locks.any? && @newrev && @oldrev &&
project.default_branch == @branch_name # locks protect default branch only
end
......
module SystemCheck
module Geo
class ClocksSynchronizationCheck < SystemCheck::BaseCheck
set_name 'Machine clock is synchronized'
def check?
Net::NTP.get.offset.abs < Gitlab::Geo::JwtRequestDecoder::IAT_LEEWAY
end
def show_error
try_fixing_it(
'Enable a NTP service on this machine to keep clocks synchronized'
)
end
end
end
end
module SystemCheck
module Geo
class DatabaseReplicationCheck < SystemCheck::BaseCheck
set_name 'Using database streaming replication?'
set_skip_reason 'not a secondary node'
def skip?
!Gitlab::Geo.secondary?
end
def check?
ActiveRecord::Base.connection.execute('SELECT pg_is_in_recovery()').first.fetch('pg_is_in_recovery') == 't'
end
def show_error
try_fixing_it(
'Follow Geo setup instructions to configure primary and secondary nodes for streaming replication'
)
for_more_information('doc/gitlab-geo/database.md')
end
end
end
end
module SystemCheck
module Geo
class GeoDatabaseConfiguredCheck < SystemCheck::BaseCheck
set_name 'GitLab Geo secondary database is correctly configured'
set_skip_reason 'not a secondary node'
def skip?
!Gitlab::Geo.secondary?
end
def check?
Gitlab::Geo.geo_database_configured?
end
def show_error
try_fixing_it(
'Check if you enabled the `geo_secondary_role` or `geo_postgresql` in the gitlab.rb config file.'
)
for_more_information('doc/gitlab-geo/database.md')
end
end
end
end
......@@ -42,7 +42,7 @@ module SystemCheck
#
# @param [SystemCheck::BaseCheck] check_klass
def run_check(check_klass)
$stdout.print "#{check_klass.display_name} ... "
print_display_name(check_klass)
check = check_klass.new
......@@ -59,17 +59,17 @@ module SystemCheck
end
if check.check?
$stdout.puts check_klass.check_pass.color(:green)
print_check_pass(check_klass)
else
$stdout.puts check_klass.check_fail.color(:red)
print_check_failure(check_klass)
if check.can_repair?
$stdout.print 'Trying to fix error automatically. ...'
if check.repair!
$stdout.puts 'Success'.color(:green)
print_success
return
else
$stdout.puts 'Failed'.color(:red)
print_failure
end
end
......@@ -81,6 +81,26 @@ module SystemCheck
private
def print_display_name(check_klass)
$stdout.print "#{check_klass.display_name} ... "
end
def print_check_pass(check_klass)
$stdout.puts check_klass.check_pass.color(:green)
end
def print_check_failure(check_klass)
$stdout.puts check_klass.check_fail.color(:red)
end
def print_success
$stdout.puts 'Success'.color(:green)
end
def print_failure
$stdout.puts 'Failed'.color(:red)
end
# Prints header content for the series of checks to be executed for this component
#
# @param [String] component name of the component relative to the checks being executed
......
......@@ -549,7 +549,10 @@ namespace :gitlab do
checks = [
SystemCheck::Geo::LicenseCheck,
SystemCheck::Geo::EnabledCheck,
SystemCheck::Geo::HttpConnectionCheck
SystemCheck::Geo::GeoDatabaseConfiguredCheck,
SystemCheck::Geo::DatabaseReplicationCheck,
SystemCheck::Geo::HttpConnectionCheck,
SystemCheck::Geo::ClocksSynchronizationCheck
]
SystemCheck.run('Geo', checks)
......
......@@ -6,7 +6,7 @@ feature 'Path Locks', feature: true, js: true do
let(:tree_path) { project_tree_path(project, project.repository.root_ref) }
before do
allow(project).to receive(:feature_available?).with(:file_lock) { true }
allow(project).to receive(:feature_available?).with(:file_locks) { true }
project.team << [user, :master]
gitlab_sign_in(user)
......
......@@ -35,7 +35,7 @@ describe TreeHelper do
before do
allow(helper).to receive(:can?).and_return(true)
allow(helper).to receive(:current_user).and_return(user)
allow(project).to receive(:feature_available?).with(:file_lock) { true }
allow(project).to receive(:feature_available?).with(:file_locks) { true }
project.reload
end
......
......@@ -399,9 +399,9 @@ describe License do
context 'with add-ons' do
it 'returns all available add-ons' do
license = build_license_with_add_ons({ License::DEPLOY_BOARD_FEATURE => 1, License::FILE_LOCK_FEATURE => 2 })
license = build_license_with_add_ons({ License::DEPLOY_BOARD_FEATURE => 1, License::FILE_LOCKS_FEATURE => 2 })
expect(license.add_ons.keys).to include(License::DEPLOY_BOARD_FEATURE, License::FILE_LOCK_FEATURE)
expect(license.add_ons.keys).to include(License::DEPLOY_BOARD_FEATURE, License::FILE_LOCKS_FEATURE)
end
it 'can return details about a single add-on' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment