Is it possible to use fabric.contrib.files.append () in a local file?

Trying to add () to a local file using Fabric.

I would like to use

append('/etc/ssh_config', ['\n\nHost', '\n\tIdentityFile', '\n\User']) 

But unfortunately, he only tries to delete files

Trying to wrap append in local (), for example:

 local(append('/etc/ssh_config', ['\n\nHost', '\n\tIdentityFile', '\n\User'])) 

... fails.

+4
source share
1 answer

Do not believe it.

If you look at the source code to add , it scrolls the lines, avoids any regular expressions in the line, and if the line is not already present in the file based on a egrep , it does echo line >> file It should be possible to wrap it all with a triple quote fragment that can then be passed to local

+5
source

Source: https://habr.com/ru/post/1487577/


All Articles