diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-05 15:06:17 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-05 15:06:17 +0000 |
commit | 4c464055fbcdab02bb8334b148c0e35b981b239e (patch) | |
tree | 861562d77b4e8684d0498f25979d8ac85dd8f25a /lib | |
parent | 791785af5540d18eaa97da24f9ff8638e1960b72 (diff) | |
download | gitlab-ce-4c464055fbcdab02bb8334b148c0e35b981b239e.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/commits.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/database/migration_helpers.rb | 15 | ||||
-rw-r--r-- | lib/gitlab/database_importers/self_monitoring/project/create_service.rb | 23 |
3 files changed, 3 insertions, 37 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb index ffff40141de..3b9ac602c56 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -169,7 +169,7 @@ module API not_found! 'Commit' unless commit - raw_diffs = ::Kaminari.paginate_array(commit.raw_diffs.to_a) + raw_diffs = ::Kaminari.paginate_array(commit.diffs(expanded: true).diffs.to_a) present paginate(raw_diffs), with: Entities::Diff end diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index ae29546cdac..6bada921ad4 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -108,9 +108,7 @@ module Gitlab 'in the body of your migration class' end - if supports_drop_index_concurrently? - options = options.merge({ algorithm: :concurrently }) - end + options = options.merge({ algorithm: :concurrently }) unless index_exists?(table_name, column_name, options) Rails.logger.warn "Index not removed because it does not exist (this may be due to an aborted migration or similar): table_name: #{table_name}, column_name: #{column_name}" # rubocop:disable Gitlab/RailsLogger @@ -136,9 +134,7 @@ module Gitlab 'in the body of your migration class' end - if supports_drop_index_concurrently? - options = options.merge({ algorithm: :concurrently }) - end + options = options.merge({ algorithm: :concurrently }) unless index_exists_by_name?(table_name, index_name) Rails.logger.warn "Index not removed because it does not exist (this may be due to an aborted migration or similar): table_name: #{table_name}, index_name: #{index_name}" # rubocop:disable Gitlab/RailsLogger @@ -150,13 +146,6 @@ module Gitlab end end - # Only available on Postgresql >= 9.2 - def supports_drop_index_concurrently? - version = select_one("SELECT current_setting('server_version_num') AS v")['v'].to_i - - version >= 90200 - end - # Adds a foreign key with only minimal locking on the tables involved. # # This method only requires minimal locking diff --git a/lib/gitlab/database_importers/self_monitoring/project/create_service.rb b/lib/gitlab/database_importers/self_monitoring/project/create_service.rb index 4677e984305..8cd9694b741 100644 --- a/lib/gitlab/database_importers/self_monitoring/project/create_service.rb +++ b/lib/gitlab/database_importers/self_monitoring/project/create_service.rb @@ -21,7 +21,6 @@ module Gitlab :create_project, :save_project_id, :add_group_members, - :add_to_whitelist, :add_prometheus_manual_configuration def initialize @@ -126,28 +125,6 @@ module Gitlab end end - def add_to_whitelist(result) - return success(result) unless prometheus_enabled? - return success(result) unless prometheus_listen_address.present? - - uri = parse_url(internal_prometheus_listen_address_uri) - return error(_('Prometheus listen_address in config/gitlab.yml is not a valid URI')) unless uri - - application_settings.add_to_outbound_local_requests_whitelist([uri.normalized_host]) - response = application_settings.save - - if response - # Expire the Gitlab::CurrentSettings cache after updating the whitelist. - # This happens automatically in an after_commit hook, but in migrations, - # the after_commit hook only runs at the end of the migration. - Gitlab::CurrentSettings.expire_current_application_settings - success(result) - else - log_error("Could not add prometheus URL to whitelist, errors: %{errors}" % { errors: application_settings.errors.full_messages }) - error(_('Could not add prometheus URL to whitelist')) - end - end - def add_prometheus_manual_configuration(result) return success(result) unless prometheus_enabled? return success(result) unless prometheus_listen_address.present? |