-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #10507: Generic method to edit separate parameters in key="values" line #558
Fixes #10507: Generic method to edit separate parameters in key="values" line #558
Conversation
7add62d
to
ef3d543
Compare
@@ -672,3 +672,38 @@ body edit_defaults ncf_empty_select(select) | |||
max_file_size => "25M"; | |||
edit_backup => "timestamp"; | |||
} | |||
|
|||
|
|||
# Add parameter in key->values line, where -> is key_value_separator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this be replaced by edit_line ncf_add_parameter_in_list_with_enclosing_chars
with empty separators?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, because the ${match.3} and ${match.4} will be empty, and it will fail :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok!
# @parameter_constraint leading_char_separator "allow_empty_string" : true | ||
# @parameter_constraint closing_char_separator "allow_empty_string" : true | ||
# | ||
# @class_prefix file_ensure_key_value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file_edit_line_key_value_ensure_parameter_in_list
# | ||
# #### Example | ||
# | ||
# If you have an initial file (/etc/default/grub) containing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`/etc/default/grub`
# GRUB_CMDLINE_XEN="dom0_mem=16G" | ||
# ``` | ||
# | ||
# To add parameter dom0_max_vcpus=32 in the right hand side of the line, you'll need the following policy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`dom0_max_vcpus=32`
Commit modified |
ef3d543
to
76e8c40
Compare
# @documentation Edit the file, and ensure it contains the defined parameter in the list of values on the right hand side of a key->values line. | ||
# If the parameter is not there, it will be added at the end, separated by parameter_separator. | ||
# Optionnaly, you can define leading and closing character to enclose the parameters | ||
# If the lhs does not exist in the file, it will report an error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems surprising to me, I would expect this method to add the line, because we have everything we need to do it.
Commit modified |
76e8c40
to
8d5c2cb
Compare
# @documentation Edit the file, and ensure it contains the defined parameter in the list of values on the right hand side of a key->values line. | ||
# If the parameter is not there, it will be added at the end, separated by parameter_separator. | ||
# Optionnaly, you can define leading and closing character to enclose the parameters | ||
# If the lhs does not exist in the file, it will be added in the file, along with the parameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you clarify the meaning of "lhs"?
Commit modified |
8d5c2cb
to
873d065
Compare
# | ||
##################################################################################### | ||
|
||
# @name File edit line key value ensure parameter in list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File ensure key value parameter in list
Commit modified |
873d065
to
2796ba9
Compare
This PR is not mergeable to upper versions. |
OK, merging this PR |
OK, merging this PR |
https://www.rudder-project.org/redmine/issues/10507