2

I need to set the value for "dc_local_interfaces" to "127.0.0.1;::1", but the semi-colon prevents this.

This is my definition in Puppet:

augeas { "/etc/exim4/update-exim4.conf.conf":
  lens    => "Shellvars.lns",
  incl    => "/etc/exim4/update-exim4.conf.conf",
  changes => "set dc_local_interfaces 127.0.0.1;::1",
}

I tried different ways to set the value (using no apostrophes, using apostrophes, using backslash-escaped apostrophes), but none did work. Things work when I use augtool:

set /files/etc/exim4/update-exim4.conf.conf/dc_local_interfaces "'127.0.0.1;::1'"
3
  • As I was writing the question and testing in parallel, I found the answer by myself, but as there is little to find for exim/puppet in general, I decided to post this nevertheless in hope others will find it useful. You have to use apostrophes outside so you can use quotation marks inside to be able to use escaped apostrophes on the inner inside again. Yes. And it actually looks even uglier than it sounds (spaces now work too): changes => 'set dc_local_interfaces "\'127.0.0.1;::1;test 1 2 3\'"',
    – Larsen
    Apr 23, 2013 at 11:04
  • I'm kind of not sure update-exim4.conf.conf is a shellvars file… It would probably require its own lens.
    – raphink
    Apr 23, 2013 at 11:45
  • Probably, but as I couldn´t find one, I used the shellvars lens.
    – Larsen
    Apr 23, 2013 at 12:01

2 Answers 2

2

(after some hours I can now answer this directly instead of using a comment (for better formatting))

As I was writing the question and testing in parallel, I found the answer by myself, but as there is little to find for exim/puppet in general, I decided to post this nevertheless in hope others will find it useful.

You have to use apostrophes outside so you can use quotation marks inside to be able to use escaped apostrophes on the inner inside again. Yes. And it actually looks even uglier than it sounds (spaces now work too):

changes => 'set dc_local_interfaces "\'127.0.0.1;::1;test 1 2 3\'"',
0

My solution like this:

class exim4::augeas (
  $config = undef,
) {
  if $config {
    create_resources(augeas, $config, $defaults)
  }
  else {
    $hiera_config = hiera_hash('exim4::augeas', undef)
    if $hiera_config {
      create_resources(augeas, $hiera_config)
    }
  }
}

And in hiera:

exim4::augeas:
  'exim4':
    context: '/files/etc/exim4/update-exim4.conf.conf'
    lens: 'Shellvars.lns'
    incl: '/etc/exim4/update-exim4.conf.conf'
    changes:
      - "set dc_other_hostnames \"\'something.test.com\'\""

It's actually not very exim specific...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .