Project

General

Profile

Actions

User story #10507

closed

Generic method to edit separate parameters in key="values" line

Added by Nicolas CHARLES over 5 years ago. Updated 4 months ago.

Status:
Released
Priority:
N/A
Category:
Generic methods
Target version:
UX impact:
Suggestion strength:
User visibility:
Effort required:
Regression:

Description

The idea is to develop a generic method, that can ensure that one parameter exists in a list of parameters, on one single line, in the right hand side of a key=value line, where all parameters are separated by a unique character (presumably different than the key-value seperator - '=' in this example, but this may actually not be a limitation). It would look something like this:

file_edit_line_key_value_ensure_parameter_in_list(file_name, key, key_value_separator, parameter, parameter_separator)

Where:
- file_name is a string with the full path to the file to look into ("/etc/default/grub", for example)
- key is a string with the full key name ("GRUB_CMDLINE_XEN" for example)
- key_value_separator is a character used to separate key and value in a key-value line ("=" in example)
- parameter is a string representing the sub-value to ensure is present in the list of parameters that form the value part of that line. If missing, it will be added (probably at the end) ("dom0_max_vcpus=32" in example below)
- parameter_separator is a character used to separate parameters in the list (" " in example)

In file /etc/default/grub
GRUB_CMDLINE_XEN="dom0_mem=16G"
calling the method would result in
GRUB_CMDLINE_XEN="dom0_mem=16G dom0_max_vcpus=32"


Subtasks 2 (0 open2 closed)

User story #10533: adapt reporting for ncf 1.0ReleasedAlexis MoussetActions
Bug #10535: Add missing option to use "space" as a parameter separator in file_ensure_key_value_parameter_in_listReleasedAlexis MoussetActions

Related issues 1 (0 open1 closed)

Related to Rudder - User story #10561: Generic method to remove separate parameters in key="values" lineReleasedAlexis MoussetActions
Actions #1

Updated by Nicolas CHARLES over 5 years ago

  • Tracker changed from Bug to User story
Actions #2

Updated by Nicolas CHARLES over 5 years ago

  • Status changed from New to In progress
  • Assignee set to Nicolas CHARLES
Actions #3

Updated by Nicolas CHARLES over 5 years ago

  • Status changed from In progress to Pending technical review
  • Pull Request set to https://github.com/Normation/ncf/pull/558
Actions #4

Updated by Nicolas CHARLES over 5 years ago

  • Status changed from Pending technical review to In progress
Actions #5

Updated by Nicolas CHARLES over 5 years ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from Nicolas CHARLES to Alexis Mousset
Actions #6

Updated by Nicolas CHARLES over 5 years ago

  • Status changed from Pending technical review to Pending release

Applied in changeset commit:2796ba91354ee49f0ab862f6e3a89524a12d9f74.

Actions #7

Updated by Nicolas CHARLES over 5 years ago

  • Related to User story #10561: Generic method to remove separate parameters in key="values" line added
Actions #8

Updated by Vincent MEMBRÉ almost 5 years ago

  • Status changed from Pending release to Released
Actions #9

Updated by François ARMAND about 3 years ago

  • Related to Bug #15387: Clean-up Jetty abort on boot added
Actions #10

Updated by François ARMAND about 3 years ago

  • Related to deleted (Bug #15387: Clean-up Jetty abort on boot)
Actions #11

Updated by Alexis Mousset 4 months ago

  • Target version changed from 0.x to ncf-0.x
Actions #12

Updated by Alexis Mousset 4 months ago

  • Project changed from 41 to Rudder
  • Category changed from Generic methods to Generic methods
Actions

Also available in: Atom PDF