Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chef-server-ctl reconfigure fails when ldap['bind_password'] is not set #947

Closed
TonyLovesDevOps opened this issue Sep 30, 2016 · 2 comments

Comments

@TonyLovesDevOps
Copy link

TonyLovesDevOps commented Sep 30, 2016

Environment details
chef server: 12.9.1
OS: Ubuntu 12.04

Description

We ran into this problem upgrading chef-server from 12.2 to 12.9. The helper code in private-chef/libraries/helpers.rb isn't nil-safe:

def self.escape_characters_in_string(string)
    pattern = /(\'|\"|\.|\*|\/|\-|\\)/
    string.gsub(pattern){|match|"\\"  + match}
  end

Steps to reproduce the problem

  1. Modify chef-server.rb to enable LDAP logins using an LDAP server that allows anonymous binds. We set the following parameters:

    ldap['base_dn']
    ldap['host']
    ldap['login_attribute']
    ldap['tls_enabled']
    
  2. Run chef-server-ctl reconfigure

Expected result

Success

Actual result

The following error is shown, and the reconfigure fails:

Chef::Mixin::Template::TemplateError:

Chef::Mixin::Template::TemplateError (undefined method `gsub' for nil:NilClass) on line #88:

 86:             {timeout, <%= node['private_chef']['ldap']['timeout'] || 60000 %> },
 87:             {bind_dn, "<%= node['private_chef']['ldap']['bind_dn'] || "" %>" },
 88:             {bind_password, "<%= @helper.escape_characters_in_string(node['private_chef']['ldap']['bind_password']) || "" %>" },
 89:             {base_dn, "<%= node['private_chef']['ldap']['base_dn'] || "" %>" },
 90:             {group_dn, "<%= node['private_chef']['ldap']['group_dn'] || "" %>" },

  /var/opt/opscode/local-mode-cache/cookbooks/private-chef/libraries/helper.rb:161:in `escape_characters_in_string'
  /var/opt/opscode/local-mode-cache/cookbooks/private-chef/libraries/helper.rb:165:in `escape_characters_in_string'
@stevendanna
Copy link
Contributor

Fixed in #974 (not yet released, new release coming soon)

@stevendanna
Copy link
Contributor

Chef 12.10.0 has been released which fixes this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants