set_variable_values_ini for values with equal sign

211 views
Skip to first unread message

Jeremy Grant

unread,
Feb 21, 2013, 11:10:48 PM2/21/13
to help-c...@googlegroups.com
I am trying to edit /etc/sssd/sssd.cf with set_variable_values_ini and finding there is a problem with ldap_default_bind_dn and ldap_search_base since it keep appending to the end of those lines:

ldap_search_base=dc=ch,dc=lan=ch,dc=lan=ch,dc=lan
ldap_default_bind_dn=uid=unix-auth-name,ou=Service Accounts,dc=ch,dc=lan=unix-auth-name,ou=Service Accounts,dc=ch,dc=lan=unix-auth-name,ou=Service Accounts,dc=ch,dc=lan

it should just be:

ldap_search_base=dc=ch,dc=lan
ldap_default_bind_dn=uid=unix-auth-name,ou=Service Accounts,dc=ch,dc=lan

All of the other variables set just fine.  Just these two have problems.

Here is my promise:

vars:   
                "sssd[domain/default][ldap_uri]" string => "ldaps://ldap01.ch.lan,ldaps://ldap02.ch.lan";
                "sssd[domain/default][ldap_default_authtok_type]" string => "password";
                "sssd[domain/default][ldap_tls_cacertdir]" string => "/etc/openldap/certs";
                "sssd[domain/default][ldap_tls_reqcert]" string => "never";
                "sssd[domain/default][auth_provider]" string => "ldap";
                "sssd[domain/default][chpass_provider]" string => "ldap";
                "sssd[domain/default][id_provider]" string => "ldap";
                "sssd[domain/default][enumerate]" string => "true";
                "sssd[domain/default][ldap_default_bind_dn]" string => "uid=unix-auth-name,ou=Service Accounts,dc=ch,dc=lan";
                "sssd[domain/default][ldap_search_base]" string => "dc=ch,dc=lan";
files:  
                "/etc/sssd/sssd.conf"
                        handle => "sssd_conf",
                        comment => "updated entries in /etc/sssd/sssd.conf file",
                        edit_line => set_variable_values_ini("sssd_conf.sssd", "domain/default"),
                        perms => mog("0600", "root", "root"),
                        classes => if_repaired("restart_sssd");

Is there anything I can do to make this work?

Nick Anderson

unread,
Feb 21, 2013, 11:47:19 PM2/21/13
to help-c...@googlegroups.com
On 02/21/2013 10:10 PM, Jeremy Grant wrote:
> I am trying to edit /etc/sssd/sssd.cf with set_variable_values_ini and
> finding there is a problem with ldap_default_bind_dn and
> ldap_search_base since it keep appending to the end of those lines:

Looking at set_variable_values_ini in the stdlib its using edit_field to
set the second column to the value you specified, so its not really
appending, its just setting the second field to your entire string,
which it sees as more columns.

https://github.com/cfengine/core/blob/master/masterfiles/libraries/cfengine_stdlib.cf#L381

I think for any of the set_variable_values to support multiple = in the
same line they will need to use a replace_pattern like the
set_config_values bundle.

https://github.com/cfengine/core/blob/master/masterfiles/libraries/cfengine_stdlib.cf#L455

> Is there anything I can do to make this work?

Can you please file a bug on this?

Jeremy Grant

unread,
Feb 22, 2013, 3:28:32 PM2/22/13
to help-c...@googlegroups.com
Thanks I will get a ticket entered.  I will also look at the set_config_values to see how it might help to make the change to fix this. 

HJ Ko

unread,
Jan 17, 2018, 8:27:22 AM1/17/18
to help-c...@googlegroups.com


Am Freitag, 22. Februar 2013 21:28:32 UTC+1 schrieb Jeremy Grant:

Thanks I will get a ticket entered.  I will also look at the set_config_values to see how it might help to make the change to fix this. 

I think the bug still exists in 3.10.2. Do you have a link to the ticket?

edit: found it: https://tracker.mender.io/browse/CFE-413
Reply all
Reply to author
Forward
0 new messages