On Jun 21, 2010, at 7:05 AM, Guus Houtzager wrote:

> Hi,
> 
> I've got a bit of an issue with Augeas in Puppet. I'm trying to
> modify /etc/sysconfig/i18n (RHEL4 system). Original file:
> LANG="en_US.UTF-8"
> SUPPORTED="en_US.UTF-8:en_US:en"
> SYSFONT="latarcyrheb-sun16"
> 
> This is the code to change it:
>        $filename = $operatingsystem ? {
>                redhat => "/etc/sysconfig/i18n",
>                sles => "/etc/sysconfig/language"
>        }
> 
>        augeas { "$filename":
>                context => $operatingsystem ? {
>                        redhat => "/files/etc/sysconfig/i18n",
>                        sles => "/files/etc/sysconfig/language"
>                },
>                changes => $operatingsystem ? {
>                        redhat => 'set LANG "en_US"',
>                        sles => ["set RC_LANG \"en_US\"","set
> ROOT_USES_LANG \"yes\""]
>                },
>        }
> 
> After trying quite a few things with different style quotes (you can
> see another try in the SLES part), I can't get Augeas to do what I
> want. I need:
> LANG="en_US"
> I've been able to do:
> LANG=en_US
> LANG=\"en_US\"
> LANG='en_US'
> 
> Client system is running puppet 0.25.5, augeas 0.7.1 and ruby-augeas
> 0.3.0.
> 
> Can anybody see what I'm doing wrong? Thanks a lot!!

First, quotes probably aren't needed unless the value has a space in it.  
Second, single quotes should work fine.

Anyway, here's an example that will work for something that has a space in it, 
and needs to be quoted:

    augeas { "auto start tftpd" :
        context => "/files/etc/default/tftpd-hpa",
        changes => 'set RUN_DAEMON \'"start now"\'', 
    }

Gives a line that looks like:
RUN_DAEMON="start now"

Here's why it works: http://osdir.com/ml/puppet-users/2009-10/msg00133.html

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" 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-users?hl=en.

Reply via email to