Issue #4695 has been updated by Shish Moom.

For anyone else who finds this page looking for the specific problem of "puppet 
can't be used to install postgres", here is a horrible, horrible hack:

<pre>
        # normally there would be no need for requires, apt-get
        # would take care of it; but in this case we want postgres
        # installed with some special options
        package { "my-website-which-uses-postgres":
                ensure => installed,
                require => [
                        Exec['utf8 postgres'],
                ]
        }
        package { "postgresql-9.0":
                ensure => installed,
        }
        exec { "utf8 postgres":
                command => "/usr/bin/pg_dropcluster --stop 9.0 main ; 
/usr/bin/pg_createcluster --start --locale en_GB.UTF-8 9.0 main",
                unless  => "sudo -u postgres psql -t -c '\l' | grep template0 | 
grep -q UTF",
                require => Package['postgresql-9.0'],
                path => ["/bin", "/sbin", "/usr/bin", "/usr/sbin"],
        }
</pre>

Do be warned that this will mercilessly destroy your entire database if it 
isn't in UTF8 mode already :)
----------------------------------------
Bug #4695: Puppet should not reset locale
https://projects.puppetlabs.com/issues/4695

Author: Mo Morsi
Status: Accepted
Priority: High
Assignee: 
Category: exec
Target version: 2.7.x
Affected Puppet version: 
Keywords: 
Branch: 


Puppet resets various locale related ENV variables to the posix default of 'C' 
immediately before invoked Kernel.exec to launch an executable (occurs when 
running a Single_exec in a recipe)

http://github.com/reductivelabs/puppet/blob/master/lib/puppet/util.rb#L295

The problem is, the python interpreter will attempt to parse these variables to 
determine the default locale, and if it is set to 'C' (or not set at all as it 
will default to 'C'), 'None' will be returned, ignoring the true default locale.

Thus any python script launched via Single_exec from a puppet recipe will not 
be able to get the default locale by invoking locale.getdefaultlocale(). This 
functionality is part of the standard python library and is relied upon by many 
various Python scripts.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to