Project

General

Profile

Actions

Bug #5979

closed

Document usage of line replacement in Enforce a file content technique

Bug #5979: Document usage of line replacement in Enforce a file content technique

Added by Dennis Cabooter over 11 years ago. Updated about 11 years ago.

Status:
Released
Priority:
1 (highest)
Category:
Techniques
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
Name check:
Fix check:
Regression:

Description

Situation:

In file /etc/sysctl.conf:

node 1 has: kernel.shmmax = 1234
node 2 has: kernel.shmmax = 4321
node 3 has: kernel.shmmax = 2143

Actually the value could be anything. And I don't (want to) know what is is.

Now I want to accomplish this:

node 1 has: kernel.shmmax = 5678
node 2 has: kernel.shmmax = 5678
node 3 has: kernel.shmmax = 5678

What I need here is one simple regex that matches:

All lines in sysctl.conf, which start with "kernel.shmmax", followed by a space, followed by an = sign, followed by a space, followed by a number I don't know.

Please provide documentation on how to do this.


Related issues 1 (0 open1 closed)

Has duplicate Rudder - Bug #6431: How to line replacement in Enforce a file content RejectedNicolas CHARLESActions

Updated by Nicolas CHARLES over 11 years ago Actions #1

Hi Dennis,

To do that, you need to use the technique enforce a file content, with parameters
Path or file name: /etc/sysctl.conf
Enable the replacement of lines using a regexp: True
Regular expression kernel.shmmax = (?!5678$).*
String used as a remplacement kernel.shmmax = 5678

Note: we are eagerly backslashing backslashes, so \s get replaced by \\s, breaking the regexp, and causing your issue. Sorry about that, i'm opening a ticket for this

Updated by Dennis Cabooter over 11 years ago Actions #2

Problem solved. Maybe i would be nice to document the way regexes are working within techniques. This (?!5678$).* I really didn't know.

Updated by Nicolas CHARLES about 11 years ago Actions #3

  • Category set to Techniques
  • Assignee set to Nicolas CHARLES
  • Target version set to 2.10.13

Updated by Nicolas CHARLES about 11 years ago Actions #4

  • Status changed from New to Pending technical review
  • Assignee changed from Nicolas CHARLES to Benoît PECCATTE
  • Pull Request set to https://github.com/Normation/rudder-techniques/pull/647

Updated by Nicolas CHARLES about 11 years ago Actions #5

  • Related to deleted (Bug #6431: How to line replacement in Enforce a file content )

Updated by Nicolas CHARLES about 11 years ago Actions #6

  • Has duplicate Bug #6431: How to line replacement in Enforce a file content added

Updated by Nicolas CHARLES about 11 years ago Actions #7

  • Status changed from Pending technical review to Pending release
  • % Done changed from 0 to 100

Updated by Vincent MEMBRÉ about 11 years ago Actions #9

  • Subject changed from Please document usage of line replacement in Enforce a file content technique to Document usage of line replacement in Enforce a file content technique

Updated by Vincent MEMBRÉ about 11 years ago Actions #10

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 2.10.13, 2.11.10 and 3.0.4 which were released today.

Actions

Also available in: PDF Atom