Skip to content

Fix API elasticsearch settings update

What does this MR do?

This MR fixes the exception when user tries to update elasticsearch_shards or elasticsearch_replicas via API.

This bug was introduced in !57567 (merged) where we changed the update logic for these settings.

PUT http://localhost:3000/api/v4/application/settings?elasticsearch_shards=16

NoMethodError (undefined method `to_h' for "16":String
Did you mean?  to_d
               to_r
               to_f
               to_i
               to_s
               to_c):
  /home/dgruzd/projects/gdk-ee/gitlab/ee/app/services/ee/application_settings/update_service.rb:54:in `update_elasticsearch_index_settings'
  /home/dgruzd/projects/gdk-ee/gitlab/ee/app/services/ee/application_settings/update_service.rb:29:in `execute'
  /home/dgruzd/projects/gdk-ee/gitlab/lib/api/settings.rb:227:in `block in <class:Settings>'

#329669 (closed)

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team

Closes #329669 (closed)

Edited by Dmitry Gruzd

Merge request reports