GitLab Documentation

Adding deprecation messages

Adding deprecation messages

As part of our deprecation policy we may need to add messages to gitlab-ctl reconfigure that advise the user of any deprecated settings they are using.

To do this we should add code that detects the use of the old setting, handles the value (for instance remapping it to a new setting), and notify the user that they have something to do with LoggingHelper.deprecation.

Here's an example from the nginx cookbook:

    def parse_nginx_listen_address
      return unless Gitlab['nginx']['listen_address']

      # The user specified a custom NGINX listen address with the legacy
      # listen_address option. We have to convert it to the new
      # listen_addresses setting.
      LoggingHelper.deprecation "nginx['listen_address'] is deprecated. Please use nginx['listen_addresses']"
      Gitlab['nginx']['listen_addresses'] = [Gitlab['nginx']['listen_address']]
    end

If we need to print Ruby objects, we can make use of the print_ruby_object helper method. This needs OutputHelper class to be included in your code. Take a look at gitaly library for an example.

Was this helpful? Do you think that something is unclear? Use the comments area below and leave your feedback. For support and other enquiries, see getting help.