我需要将“dc_local_interfaces”的值设置为“127.0.0.1; :: 1”,但是分号可以防止出现这种情况。
这是我在木偶的定义:
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", }
我尝试了不同的方法来设置值(不使用撇号,使用撇号,使用反斜线转义的撇号),但没有工作。 事情在我使用augtool时有效:
set /files/etc/exim4/update-exim4.conf.conf/dc_local_interfaces "'127.0.0.1;::1'"
(几个小时后,我现在可以直接回答,而不是使用评论(为了更好的格式))
当我在写问题和testing的时候,我自己find了答案,但是因为一般来说没有什么可以find的,所以我决定发布这个,希望其他人能够发现它。
你必须在外面使用撇号,所以你可以在里面使用引号,以便能够再次在内部使用逃脱的撇号。 是。 它实际上看起来更丑陋(空间现在也可以):
changes => 'set dc_local_interfaces "\'127.0.0.1;::1;test 1 2 3\'"',
我的解决scheme如下:
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) } } }
而在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\'\""
这实际上不是非常exim具体…