Project

General

Profile

Actions

Bug #6431

closed

How to line replacement in Enforce a file content

Added by Anthony Lawson about 6 years ago. Updated about 6 years ago.

Status:
Rejected
Priority:
1
Category:
Techniques
Target version:
Severity:
User visibility:
Effort required:
Priority:

Description

Situation:

In file /etc/myservice.config on server1:
mail.recipients=,,

In file /etc/myservice.config on server2:
#mail.recipients=

I want to change these parameters to mail.recipients=
My Regex: [#]?(mail.recipients=).*
My String remplacement: mail.recipients=

But it doesn't work
Please provide docmentation on how to do this


Related issues

Is duplicate of Rudder - Bug #5979: Document usage of line replacement in Enforce a file content techniqueReleasedBenoƮt PECCATTE2014-12-11Actions
Actions #1

Updated by Nicolas CHARLES about 6 years ago

  • Status changed from New to Discussion
  • Assignee set to Anthony Lawson

Hi Anthony,

To replace a line with Enforce a file content (or with any other technique/generic method that would do replacement), you need that the regexp doesn't match the string you are putting.

So, the regexp you'll need probably is

[#]?mail.recipients=(?!ops@mydom.com$).*

Actions #2

Updated by Anthony Lawson about 6 years ago

Hi Nicolas,

Thanks, it works fine for me

Actions #3

Updated by Dennis Cabooter about 6 years ago

Hi Nicolas,

Maybe it would be a good idea to add an example like this in the documentation. I needed it once as well and fortunatly you were helping me to get it right. To be honest I'm able to do some basic regex, but I'm not a regex guru. :D

Actions #4

Updated by Nicolas CHARLES about 6 years ago

  • Category set to Techniques
  • Status changed from Discussion to 8
  • Assignee changed from Anthony Lawson to Nicolas CHARLES
  • Target version set to 2.10.13
Actions #5

Updated by Nicolas CHARLES about 6 years ago

  • Related to deleted (Bug #5979: Document usage of line replacement in Enforce a file content technique)
Actions #6

Updated by Nicolas CHARLES about 6 years ago

  • Is duplicate of Bug #5979: Document usage of line replacement in Enforce a file content technique added
Actions #7

Updated by Nicolas CHARLES about 6 years ago

  • Status changed from 8 to Rejected

Rejecting as a duplicate of 5979; it is fixed there

Actions

Also available in: Atom PDF