Skip to content

Setting values with spaces is not working (sets every time) #2

@TJM

Description

@TJM

Using the following puppet code:

    chsec { 'user-default-SYSTEM':
      ensure    => present,
      file      => '/etc/security/user',
      stanza    => 'default',
      attribute => 'SYSTEM',
      value     => 'compat or KRB5LDAP',
      require   => Service['secldapclntd'],
    }

Puppet continually sets the value:

Debug: Executing: '/usr/bin/chsec -f /etc/security/user -s default -a SYSTEM=compat or KRB5LDAP'
Notice: Chsec[user-default-SYSTEM](provider=aix): Changed /etc/security/user default:SYSTEM to compat or KRB5LDAP
Notice: /Stage[main]/Aixldap::Configure/Chsec[user-default-SYSTEM]/ensure: created

Likely due to the following provider code:

if command.split.last.split("=")[1..-1].join('=').strip != resource[:value]

Workaround

    exec { 'chsec-user-default-SYSTEM':
      command => 'chsec -f /etc/security/user -s default -a SYSTEM="compat or KRB5LDAP"',
      onlyif  => 'lssec -f /etc/security/user -s default -a SYSTEM | awk -F= \'{print $2}\' | grep -q "compat or KRB5LDAP"',
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions