-
-
Notifications
You must be signed in to change notification settings - Fork 387
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
files.Block
: fixed couple of bugs, added try_prevent_shell_expansion
and support for content: list[str]
#1030
Conversation
try_prevent_shell_expansion
and support for content: list[str]
try_prevent_shell_expansion
and support for content: list[str]
try_prevent_shell_expansion
and support for content: list[str]
files.Block
: fixed couple of bugs, added try_prevent_shell_expansion
and support for content: list[str]
@@ -1661,7 +1666,7 @@ def block( | |||
) | |||
|
|||
# have two entries in /etc/host | |||
files.marked_block( | |||
files.block( |
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.
@@ -1614,6 +1614,7 @@ def block( | |||
line=None, | |||
backup=False, | |||
escape_regex_characters=False, | |||
try_prevent_shell_expansion=False, |
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.
#1029
helps with mentioned issue
@@ -1748,21 +1773,30 @@ def block( | |||
f"{print_after} f!=1 && /{regex}/ {{ print x; f=1}} " | |||
f"END {{if (f==0) print ARGV[2] }} {print_before}'" | |||
) | |||
cmd = StringCommand(out_prep, prog, q_path, f'$"{the_block}"', "> $OUT &&", real_out) |
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.
...f'$"{the_block}"'
...
Removed $
) | ||
cmd = StringCommand( | ||
out_prep, | ||
prog, | ||
q_path, | ||
'$"' + content + '"', |
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.
'$"' + content + '"',
Removed $
): # marked_block found but text is different | ||
prog = ( | ||
'awk \'BEGIN {{f=1; x=ARGV[2]; ARGV[2]=""}}' | ||
f"/{mark_1}/ {{print; print x; f=0}} /{mark_2}/ {{print; f=1}} f'" | ||
f"/{mark_1}/ {{print; print x; f=0}} /{mark_2}/ {{print; f=1; next}} f'" |
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.
#1031
Fixes this issue
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.
@stone-w4tch3r huge thank you for working on this, I have to admit I have been struggling greatly to wrap my head around this operation, hugely appreciate your work here. Finally have pushed up some minor changes and fixed the tests to get this in.
(force push to get github to actually run actions, being very flakey at the moment) |
#1028
Removed dollar signs, looks like they were typo
#984
As #984 (comment), renamed
files.marked_block
in documentation tofiles.block
#1031
Adjusted
awk
to prevent duplications#1029
Added
try_prevent_shell_expansion
parameter to partially help with mentioned issueAnd also changed type for
content
tostr | list[str]
. This makes it more unified withfacts.files.Block
, that already returnslist[str]