Using puppet to modify a listener.ora
file:
file_line { 'addFloatingListenerTCPS':
ensure => present,
path => "${LSNR_PATH}/listener.ora",
line => " (ADDRESS = (PROTOCOL = TCPS)(HOST = ${FLOATING_IP})(PORT = 1522))",
after => "^\s+(ADDRESS = (PROTOCOL = TCPS)(HOST = DB)(PORT = 1522))",
require => Class["othernode"]
}
This doesn't cause any puppet errors, but places the new entry all the way at the end of the file, rather than inside the listener block where it should be. (To me this indicates that the after
attribute value is not matching the file contents, thus puppet defaults to append mode).
Changing the after
attribute value to escape all of the parenthesis:
after => "^\s+\(ADDRESS = \(PROTOCOL = TCPS\)\(HOST = DB\)\(PORT = 1522\)\)",
Generates multiple warnings in the console:
Warning: Unrecognised escape sequence '\(' in file /etc/puppet/modules/test_conf/manifests/init.pp at line 30
Warning: Unrecognised escape sequence '\(' in file /etc/puppet/modules/test_conf/manifests/init.pp at line 30
Warning: Unrecognised escape sequence '\)' in file /etc/puppet/modules/test_conf/manifests/init.pp at line 30
Warning: Unrecognised escape sequence '\(' in file /etc/puppet/modules/test_conf/manifests/init.pp at line 30
Warning: Unrecognised escape sequence '\)' in file /etc/puppet/modules/test_conf/manifests/init.pp at line 30
Warning: Unrecognised escape sequence '\(' in file /etc/puppet/modules/test_conf/manifests/init.pp at line 30
Warning: Unrecognised escape sequence '\)' in file /etc/puppet/modules/test_conf/manifests/init.pp at line 30
Warning: Unrecognised escape sequence '\)' in file /etc/puppet/modules/test_conf/manifests/init.pp at line 30
making it unusable in satellite. However, execution does complete and afterwards the new entry is inside the block where it should be.
This raises multiple questions:
- Are parenthesis interpreted as special chars, and if so why can't they be escaped?
- Do puppet stdlib regular expressions handle back references?