Error in parsing LDAP settings from config file
Dev: https://dev.gitlab.org/gitlab/gitlab-ee/issues/319
Patricio
There is a bug originating from the LDAP config that results in the following error:
Completed 500 Internal Server Error in 35ms
ActionView::Template::Error (undefined method `label' for #<Hash:0x007f583ac72498>):
5: = f.label :cn, class: 'control-label' do
6: LDAP Server
7: .col-sm-10
8: = f.select :provider, ldap_server_select_options, {}, class: 'form-control'
9: .form-group.clearfix
10: = f.label :cn, class: 'control-label' do
11: LDAP Group cn
app/helpers/selects_helper.rb:36:in `ldap_server_select_options'
app/views/ldap_group_links/_form.html.haml:8:in `block in _app_views_ldap_group_links__form_html_haml___2927754084684384365_70008490337560'
app/views/ldap_group_links/_form.html.haml:2:in `_app_views_ldap_group_links__form_html_haml___2927754084684384365_70008490337560'
app/views/admin/groups/_form.html.haml:30:in `_app_views_admin_groups__form_html_haml___2770179672370540949_70008488844860'
app/views/admin/groups/edit.html.haml:3:in `_app_views_admin_groups_edit_html_haml__3832552802585749870_70008488722280'
Response from Douwe in https://dev.gitlab.org/gitlab/gitlab-ee/issues/311
The error seems to originate in this piece of code that generates the options for the "LDAP Server" select box in the LDAP Group Links form:
def ldap_server_select_options
options_from_collection_for_select(
Gitlab::LDAP::Config.servers,
'provider_name',
'label'
)
end
Gitlab::LDAP::Config.servers
is supposed to be an array ofSettingslogic
objects, that are like hashes but also allow their keys to be accessed as methods.
For some reason, they ended up with
Gitlab::LDAP::Config.servers
as an array ofHash
objects, which don't support that, hence the error.
Gitlab::LDAP::Config.servers
originates fromGitlab.config.ldap.servers.values
, and in our settings initializer, the settings underldap/server
are converted from hashes toSettingslogic
objects like so:
if Settings.ldap['enabled']
# ...
Settings.ldap['servers'].each do |key, server|
server = Settingslogic.new(server)
# ...
Settings.ldap['servers'][key] = server
end
end
Note that this conversion doesn't happen if LDAP is disabled.
Job
what is the impact of this bug?
Patricio
so far only William @ Company has seen it. It can happen more often, though. Since this hasn't happened that often, I propose to schedule it for 7.16. Do you agree?
Job
I mean, what happens? How often for William?
Patricio
it happens every single times he disables LDAP. Once he does that he is unable to browse any of the groups. The workaround was to comment out the entire LDAP settings in the
gitlab.yml
file. It didn't matter that LDAP was turned off, GitLab was still trying to read the settings and failing.
that is annoying, but I don't think people will very often do this. I don't see why postpone until 7.16. Fix shouldn't be very hard.
Maybe not promise? I'll schedule for 7.15.
Patricio
that sounds perfect. William is already happy with the workaround, so there is no need to promise it to him. It will be nice to fix it sooner rather than later, though.