Augeas and double quotes

1,826 views
Skip to first unread message

Guus Houtzager

unread,
Jun 21, 2010, 10:05:16 AM6/21/10
to Puppet Users
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!!

Regards,

Guus

Patrick Mohr

unread,
Jun 21, 2010, 5:40:50 PM6/21/10
to puppet...@googlegroups.com

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

Guus Houtzager

unread,
Jun 22, 2010, 9:33:06 AM6/22/10
to puppet...@googlegroups.com
On Mon, Jun 21, 2010 at 11:40 PM, Patrick Mohr <kc7...@gmail.com> wrote:
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

Bingo, problem solved, thanks :)
I had tried quite a lot of quote variations, but not this one.

Regards,

Guus
Reply all
Reply to author
Forward
0 new messages