pyinfra turns Python code into shell commands and runs them on your servers. Execute ad-hoc commands and write declarative operations. Target SSH servers, local machine and Docker containers. Fast and scales from one server to thousands.
3. See result on remote:
NOTE: due to #1028 `file.block` adds a `$`, but even after fixing this behavior issue with redundant marker persists
```bash
cat file
hello
#### BEGIN BLOCK ####
$blah blah
#### END BLOCK ####
#### END BLOCK ####
bye
Target system information
Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-164-generic x86_64)
Expected behavior
No duplication after running operation
Meta
Include output of pyinfra --support.
pyinfra --support
--> Support information:
If you are having issues with pyinfra or wish to make feature requests, please
check out the GitHub issues at https://github.com/Fizzadar/pyinfra/issues .
When adding an issue, be sure to include the following:
System: Linux
Platform: Linux-6.2.0-36-generic-x86_64-with-glibc2.37
Release: 6.2.0-36-generic
Machine: x86_64
pyinfra: v2.8
Executable: /home/user/Projects/linux_stuff/pyinfra_manager/venv/bin/pyinfra
Python: 3.11.4 (CPython, GCC 12.3.0)
How was pyinfra installed (source/pip)?
pip
Include pyinfra-debug.log (if one was created)
None
Issue is in final awk code:
awk 'BEGIN {{f=1; x=ARGV[2]; ARGV[2]=""}}/#### BEGIN BLOCK ####/ {print; print x; f=0} /#### END BLOCK ####/ {print; f=1} f' ...
Describe the bug
If file with marked block already exists, but content is not what expected, files.block will append redundant marker line after block
To Reproduce
main.py
:files.block( path="/home/ubuntu/file", content="blah blah", marker="#### {mark} BLOCK ####", )
Expected behavior
No duplication after running operation
Meta
Include output of
pyinfra --support
.-vv
and--debug
.