Explicitly splat group parameters in create team
What does this MR do and why?
Explicitly splat group parameters in create team
- When creating a group in Mattermost automatically from the create
group feature, it will fail / generate a 500 error because the
parameters are passed as a dictionary. This worked in Ruby 2
but requires an explicit **SPLAT** in Ruby 3.
Changelog: fixed
Signed-off-by: Robert Marshall <rmarshall@gitlab.com>
How to set up and validate locally
- Install GitLab with Mattermost enabled
- Try to create a group automatically in Mattermost when creating a new group in GitLab
- Receive a 500 error and note the error in the rails production log
{
"method": "POST",
"path": "/groups",
"format": "html",
"controller": "GroupsController",
"action": "create",
"status": 500,
"time": "2023-03-06T23:22:16.704Z",
"params": [
{
"key": "authenticity_token",
"value": "[FILTERED]"
},
{
"key": "group",
"value": {
"parent_id": "",
"name": "FooGroup",
"path": "foogroup",
"visibility_level": "20",
"create_chat_team": "true",
"jobs_to_be_done": "",
"emails": [
""
]
}
},
{
"key": "user",
"value": {
"role": "software_developer"
}
}
],
"correlation_id": "01GTWKQ6PYHF5GJSPBCQBHSTCB",
"meta.caller_id": "GroupsController#create",
"meta.remote_ip": "192.168.122.1",
"meta.feature_category": "subgroups",
"meta.user": "root",
"meta.user_id": 1,
"meta.client_id": "user/1",
"remote_ip": "192.168.122.1",
"user_id": 1,
"username": "root",
"ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36",
"queue_duration_s": 0.015355,
"request_urgency": "low",
"target_duration_s": 5,
"redis_calls": 11,
"redis_allowed_cross_slot_calls": 1,
"redis_duration_s": 0.0019270000000000001,
"redis_read_bytes": 1399,
"redis_write_bytes": 1625,
"redis_cache_calls": 6,
"redis_cache_duration_s": 0.001458,
"redis_cache_read_bytes": 1216,
"redis_cache_write_bytes": 410,
"redis_sessions_calls": 4,
"redis_sessions_allowed_cross_slot_calls": 1,
"redis_sessions_duration_s": 0.000377,
"redis_sessions_read_bytes": 183,
"redis_sessions_write_bytes": 1162,
"redis_shared_state_calls": 1,
"redis_shared_state_duration_s": 9.2e-05,
"redis_shared_state_write_bytes": 53,
"db_count": 5,
"db_write_count": 0,
"db_cached_count": 0,
"db_replica_count": 0,
"db_primary_count": 5,
"db_main_count": 5,
"db_main_replica_count": 0,
"db_replica_cached_count": 0,
"db_primary_cached_count": 0,
"db_main_cached_count": 0,
"db_main_replica_cached_count": 0,
"db_replica_wal_count": 0,
"db_primary_wal_count": 0,
"db_main_wal_count": 0,
"db_main_replica_wal_count": 0,
"db_replica_wal_cached_count": 0,
"db_primary_wal_cached_count": 0,
"db_main_wal_cached_count": 0,
"db_main_replica_wal_cached_count": 0,
"db_replica_duration_s": 0,
"db_primary_duration_s": 0.002,
"db_main_duration_s": 0.002,
"db_main_replica_duration_s": 0,
"cpu_s": 0.029715,
"mem_objects": 12464,
"mem_bytes": 1974896,
"mem_mallocs": 4519,
"mem_total_bytes": 2473456,
"pid": 15432,
"worker_id": "puma_2",
"rate_limiting_gates": [],
"exception.class": "ArgumentError",
"exception.message": "wrong number of arguments (given 1, expected 0; required keywords: name, display_name, type)",
"exception.backtrace": [
"lib/mattermost/team.rb:12:in `create'",
"app/services/mattermost/create_team_service.rb:12:in `execute'",
"app/services/groups/create_service.rb:32:in `execute'",
"ee/app/services/ee/groups/create_service.rb:10:in `execute'",
"app/controllers/groups_controller.rb:84:in `create'",
"ee/lib/gitlab/ip_address_state.rb:10:in `with'",
"ee/app/controllers/ee/application_controller.rb:46:in `set_current_ip_address'",
"app/controllers/application_controller.rb:524:in `set_current_admin'",
"lib/gitlab/session.rb:11:in `with_session'",
"app/controllers/application_controller.rb:515:in `set_session_storage'",
"lib/gitlab/i18n.rb:107:in `with_locale'",
"lib/gitlab/i18n.rb:113:in `with_user_locale'",
"app/controllers/application_controller.rb:506:in `set_locale'",
"app/controllers/application_controller.rb:499:in `set_current_context'",
"lib/gitlab/metrics/elasticsearch_rack_middleware.rb:16:in `call'",
"lib/gitlab/middleware/memory_report.rb:13:in `call'",
"lib/gitlab/middleware/speedscope.rb:13:in `call'",
"lib/gitlab/database/load_balancing/rack_middleware.rb:23:in `call'",
"lib/gitlab/middleware/rails_queue_duration.rb:33:in `call'",
"lib/gitlab/metrics/rack_middleware.rb:16:in `block in call'",
"lib/gitlab/metrics/web_transaction.rb:46:in `run'",
"lib/gitlab/metrics/rack_middleware.rb:16:in `call'",
"lib/gitlab/jira/middleware.rb:19:in `call'",
"lib/gitlab/middleware/go.rb:20:in `call'",
"lib/gitlab/etag_caching/middleware.rb:21:in `call'",
"lib/gitlab/middleware/query_analyzer.rb:11:in `block in call'",
"lib/gitlab/database/query_analyzer.rb:37:in `within'",
"lib/gitlab/middleware/query_analyzer.rb:11:in `call'",
"lib/gitlab/middleware/multipart.rb:173:in `call'",
"lib/gitlab/middleware/read_only/controller.rb:50:in `call'",
"lib/gitlab/middleware/read_only.rb:18:in `call'",
"lib/gitlab/middleware/same_site_cookies.rb:27:in `call'",
"lib/gitlab/middleware/basic_health_check.rb:25:in `call'",
"lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call'",
"lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'",
"lib/gitlab/middleware/request_context.rb:21:in `call'",
"lib/gitlab/middleware/webhook_recursion_detection.rb:15:in `call'",
"config/initializers/fix_local_cache_middleware.rb:11:in `call'",
"lib/gitlab/middleware/compressed_json.rb:37:in `call'",
"lib/gitlab/middleware/rack_multipart_tempfile_factory.rb:19:in `call'",
"lib/gitlab/middleware/sidekiq_web_static.rb:20:in `call'",
"lib/gitlab/metrics/requests_rack_middleware.rb:79:in `call'",
"lib/gitlab/middleware/release_env.rb:13:in `call'"
],
"db_duration_s": 0.00088,
"view_duration_s": 0,
"duration_s": 0.01182
}
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.