voxpupuli / puppet-augeasproviders_pam

Augeas-based PAM type and provider for Puppet
Other
5 stars 21 forks source link

Failed to save Augeas tree to file #6

Closed choonming closed 9 years ago

choonming commented 9 years ago

Hi,

I'm trying to do the following:

pam { 'set pam_mkhomedir.so to common-session':
  ensure => present,
  service => 'common-session',
  type   => 'session',
  control => 'required',
  module  => 'pam_mkhomedir.so',
  arguments => 'umask 022 skel=/etc/skel',
  position => 'after module pam_systemd.so',
}

However, it is spewing me with errors. Please help me out here.

Notice: /Stage[main]/Main/Pam[set pam_mkhomedir.so to common-session]/ensure: created
Debug: Puppet::Type::Pam::ProviderAugeas: Save failure details:
/augeas/files/etc/pam.d/common-session/error/path = /files/etc/pam.d/common-session/7
/augeas/files/etc/pam.d/common-session/error/lens = /opt/puppetlabs/puppet/share/augeas/lenses/dist/pam.aug:58.21-.51:
/augeas/files/etc/pam.d/common-session/error/message = Failed to match
    { /optional/ }?{ /type/ = /auth|session|account|password/ }{ /control/ = /\\[[^]\001-\004\n#]*\\]|[^\001-\004\t [][^\001-\004\t ]*/ }{ /module/ = /[^\001-\004\t\n #]+/ }{ /argument/ = /\\[[^]\001-\004\n#]+\\]|[^\001-\004\t\n #[][^\001-\004\t\n #]*/ }*({ /#comment/ = /[^\001-\004\t\n\r ][^\001-\004\n]*[^\001-\004\t\n\r ]|[^\001-\004\t\n\r ]/ } | ())
  with tree
    { "type" = "session" } { "control" = "required" } { "module" = "pam_mkhomedir.so" } { "argument" = "umask 022 skel=/etc/skel" }
Error: /Stage[main]/Main/Pam[set pam_mkhomedir.so to common-session]: Could not evaluate: Failed to save Augeas tree to file. See debug logs for details.
choonming commented 9 years ago

Upon further investigation, it'll only work if I do the following:

pam { 'set pam_mkhomedir.so to common-session':
  ensure => present,
  service => 'common-session',
  type   => 'session',
  control => 'required',
  module  => 'pam_mkhomedir.so',
  arguments => [ 'umask', '022', 'skel=/etc/skel'],
  position => 'after module pam_systemd.so',
}

Is it the intended to throw an error should there be a space in the arguments?

raphink commented 9 years ago

The arguments are expected as an array indeed. The type doesn't check for spaces in the values, so the value gets passed to Augeas, which doesn't like the spaces.

It might be a good to idea to validate the values for no spaces, or to split on spaces maybe.