puppet-php icon indicating copy to clipboard operation
puppet-php copied to clipboard

Augeas PHP lens fails on empty values

Open Jack12816 opened this issue 11 years ago • 3 comments

If you got a ini file with this line for example:

xcache.coveragedump_directory = ""

You cant work on this file.

Jack12816 avatar Dec 04 '14 14:12 Jack12816

that seem to be an augeas error - what do you want to do? remove the entry or?

jippi avatar Dec 04 '14 20:12 jippi

@Jack12816 iirc, the php.aug file is based off the built-in ini file lens which, yes, is actually quite buggy, especially with the regular expressions that it uses to validate the right side of an assignment. In this particular case though, the lens will refuse to set an empty string like that.

My suggestion is to fix it using the clear command that Puppet supports in the augeas resource type. In a php::config resource for the ini file in question, you can clear that entry and hopefully work around the poorly written ini file lens with this Puppet code:

php::config { 'fix-lazy-augeas-built-in-lens':
  file   => '/path/to/file.ini',
  config => [ 'clear xcache.coveragedump_directory' ],
}

This will result in your PHP ini file having this entry: xcache.coveragedump_directory= which has the exact same meaning.

I have a couple of PHP settings that I don't necessarily want to set myself, but want to make sure are unset so they use the default, and this is the method I use to do this.

dbeckham avatar Jan 09 '15 19:01 dbeckham

@jippi I was wrong about this problem. It can't be fixed with Augeas commands. The xcache module on Ubuntu 14 LTS (Trusty) is 100% incompatible with the Augeas. The Inifile lens that the PHP lens relies on is so amazingly buggy in every release before the version packaged for Ubuntu Trusty and is still broken in the latest release.

The three options are to:

  • Ask the Augeas upstream to fix the Inifile lens.
  • Ask the Ubuntu upstream maintainer of the php5-xcache package to remove the unnecessary empty quotes.
  • Add an xcache.ini file to this puppet module to replace the initial xcache config file with a sane config so that Augeas can be used.

The first two aren't ever happening. In order to get around the problem myself, I just don't bother using this module for the xcache install and do it manually. I have if "trusty" crapping up my manifests because Augeas is so broken. =(

dbeckham avatar Mar 10 '15 21:03 dbeckham