handle_deprecated_tls_config

in files/gitlab-cookbooks/consul/libraries/consul.rb [11:50]


    def handle_deprecated_tls_config
      return unless Gitlab['consul']['configuration']

      all_deprecated_tls_settings = %w[
        cert_file
        key_file
        ca_file
        ca_path
        tls_min_version
        tls_cipher_suites
        verify_incoming
        verify_incoming_rpc
        verify_incoming_https
        verify_outgoing
        verify_server_hostname
      ]

      deprecated_tls_settings = all_deprecated_tls_settings.reject { |setting| Gitlab['consul']['configuration'][setting].nil? }

      return if deprecated_tls_settings.empty?

      Gitlab['consul']['configuration']['tls'] ||= { 'defaults' => {} }

      deprecated_tls_settings.each do |setting|
        next unless Gitlab['consul']['configuration']['tls'][setting].nil?

        Gitlab['consul']['configuration']['tls']['defaults'][setting] = Gitlab['consul']['configuration'][setting]

        Gitlab['consul']['configuration'].delete(setting)

        
        
        deprecation_msg = <<~EOS
        * `consul['configuration']['#{setting}']` has been deprecated since 15.5 and will be removed in 16.0. In GitLab 15.5 Consul version has been updated to 1.12.5, starting with which this setting has been moved to a different location. Hence, move this setting to `consul['configuration']['tls']['defaults']['#{setting}']`.
        EOS

        LoggingHelper.deprecation(deprecation_msg)
      end
    end