question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sed_replace function in operations/utils calls sed with args in wrong order

See original GitHub issue

Describe the bug files.replace doesn’t work correctly because of sed arguments

To Reproduce any files.replace example

Expected behavior files.replace should work as advertised…

***** To FIX: change order of replace and line on line 58 of operations/util/files.py

Meta

  • Include output of pyinfra --support.

    System: Darwin Platform: Darwin-19.6.0-x86_64-i386-64bit Release: 19.6.0 Machine: x86_64 pyinfra: v1.0.4 Executable: /Users/x/.pyenv/versions/3.7.7/envs/infra-3.7.7/bin/pyinfra Python: 3.7.7 (CPython, Clang 11.0.3 (clang-1103.0.32.29))

  • How was pyinfra installed (source/pip)?

  • Include pyinfra-debug.log (if one was created)

  • Consider including output with -vv and --debug.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cpbrowncommented, Jul 22, 2020

Github seems to have to have no private message capability so I’ll leave a comment here… Just wanted to thank you for the effort you have put into this project. I’m coming to it as an ansible ‘refugee’ and I love what you’ve done. No more YAML! I plan to keep using it and may be able to contribute if you find my code worthy…

1reaction
cpbrowncommented, Jul 21, 2020

So sorry for the confusion on my part… there is no bug. When using file.lines, replace is the value you want to replace what matched, not the line you are replacing…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Substitution with sed + bash function
I still have a problem with this solution. The bash function is called. But the argument & seems not to be correctly copied...
Read more >
sed with multiple expression for in-place argument
I can get the following output by using sed -i two times. ... When I tried the above code it takes s/item/stuff/g as...
Read more >
Bash: trying to make a "sed-replace"-function, robust ...
Bash: trying to make a "sed-replace"-function, robust to arbitrary character input (expansion, substitution etc) Save this question.
Read more >
Using sed for Find and Replace
sed reads input text from files or stdin, then edits the text line ... file or through arguments to the CLI command, then...
Read more >
How to Use Sed to Find and Replace a String in a File
Read this guide to learn how to use the sed command to find and replace a all instances of a string in a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found