Fabric fab -f : Can't find any collection named 'fabfile'
Asked Answered
L

1

5

After updated Fabric from 1.4 to 2.4, fab -f <file_path>.<fabfile>.py isn't working anymore. It always throws the error Can't find any collection named 'fabfile'!

From fab --help, it stated that -f option is used to -f STRING, --config=STRING Runtime configuration file to use.

Thinking to downgrade it to 1.4 since all my project on other hosts are running this version. But i cant't get back the 1.4 installer on net. Anyone could help on this or any workaround for fabric 2.4 ?

Lotte answered 28/9, 2018 at 0:49 Comment(0)
S
11

This is indeed changed! Now with newer version of Fabric 2.x you must use -r instead of -f. This is based on pyinvoke check this link pyInvoke

For example: if you are in dir A and your fabfile is in dir B

dir A
|__dir B

you will be able to call your fabfile tasks by executing this command from the command-line

fab -r ./b/ yourTaskName 
Scornful answered 9/10, 2018 at 12:10 Comment(4)
You're right! I just found out this prrviously myself, ended up i downgraded it back to 1.xLotte
I had the same problem previously, but I have done is reading the changelog on their site. Then I found inside the changelog that is replaced by -f! Now, I have everything in fabric, which is imo much better than fabric1Scornful
Wait, does this mean that -f doesn't work anymore? The only valid name is fabfile.py and if I want to have multiple fabfiles I must have multiple directories each with separate fabfile.py?Derringer
It doesn't appear to be working, yet it is displayed in the "Core options" with fab2 --help.Cachepot

© 2022 - 2024 — McMap. All rights reserved.