Discussion:
[Fab-user] .fabricrc vs command line fab -f
bazfire
2015-10-15 16:42:53 UTC
Permalink
I am new to using fabric and have a question about getting fabric to use a particular fabfile.py. I am aware that fabric will look for a fabfile.py in the directory in which the command is issued. fabric will also accept a fabfile.py in the command line using the “-f” option such as

$ fab -f ~/fabfile.py -l

You can also put a definition inside the .fabricrc file such as

fabfile=~/fabfile_1.py

and run your fab command as follows

fab -l

and it will use the fabfile found at ~/fabfile_1.py.


My actual question is that it seems like that the command line option specification for the location of the fabfile should override the .fabricrc specification but it does not seem to. I would have expected the following command to work with the fabfile_2.py even though fabfile_1.py has been specified in the .fabricrc file.

$ fab -f ~/project/fabfile_2.py -l

but this command actually uses ~/fabfile_1.py


Any thoughts or comments?
Richard Vézina
2015-10-22 18:43:19 UTC
Permalink
May your issue is related to this :
https://github.com/fabric/fabric/issues/1392

Code Related Pointer :
https://github.com/fabric/fabric/blob/5217b12f8aca3bc071206f7f4168e62c003509d1/fabric/main.py#L588
https://github.com/fabric/fabric/blob/5217b12f8aca3bc071206f7f4168e62c003509d1/fabric/main.py#L644
https://github.com/fabric/fabric/blob/5217b12f8aca3bc071206f7f4168e62c003509d1/fabric/main.py#L657

load fabfile function:
https://github.com/fabric/fabric/blob/5217b12f8aca3bc071206f7f4168e62c003509d1/fabric/main.py#L135

find fabfile:
https://github.com/fabric/fabric/blob/5217b12f8aca3bc071206f7f4168e62c003509d1/fabric/main.py#L83

Not been able to figure out how option get parse and if --config is getting
preceance over --fabfile or not...

My guess is that --config may get call after --fabfile option so --fabfile
file passed get override by .fabricrc specified fabfile

If it's the case someone fixing this should write a test to make sure this
bug is not coming back...

Also, I notice that I replyed to but I intent to reply to the mailing-list,
but it goes to you personnaly because gmail reply button behavior seems to
have change (before it was replying all by default, which was a feature to
me)... I may make you think that I will solve your issue but I am not a
fabric dev... I just want to make sure that someone trying to help you get
the right information to do so, and version is really important.

Hope you will get more help, this mailing-list is strangely silent or maybe
you can address your issue your self with the pointer above.

Richard
Post by bazfire
I am new to using fabric and have a question about getting fabric to use a
particular fabfile.py. I am aware that fabric will look for a fabfile.py in
the directory in which the command is issued. fabric will also accept a
fabfile.py in the command line using the “-f” option such as
$ fab -f ~/fabfile.py -l
You can also put a definition inside the .fabricrc file such as
fabfile=~/fabfile_1.py
and run your fab command as follows
fab -l
and it will use the fabfile found at ~/fabfile_1.py.
My actual question is that it seems like that the command line option
specification for the location of the fabfile should override the .fabricrc
specification but it does not seem to. I would have expected the following
command to work with the fabfile_2.py even though fabfile_1.py has been
specified in the .fabricrc file.
$ fab -f ~/project/fabfile_2.py -l
but this command actually uses ~/fabfile_1.py
Any thoughts or comments?
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
Loading...