-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider a guardrail for the fact that -f changed to load config, not fabfile #1823
Comments
I think the problem is you're using That's the proximate cause, the root cause is I think an actual bug where we must not be stripping out module objects from Python-style config files. I thought this got fixed but it must be an outstanding PR or something...hrm, can't find. Say hi to pyinvoke/invoke#556 ... That said, unless you modified your example from the real problem case: you shouldn't need This (getting tripped up by the change in what |
Also I just double checked and we do cover this in the upgrading doc - http://www.fabfile.org/upgrading.html#id7 - so I'm covered there at least 😅 |
Hrm, I don't see a foolproof way to guard against the highest level problem (loading a fabfile as a config file) because it's technically plausible a user could do anything short of literally including a module object, in a config file. E.g. random stuff like: from requests import get
some_key = get("http://my/api/server").json() will work because What this means is, it's not possible to really detect the "oops, gave a fabfile to a config file" scenario. I think the best we can possibly do is just catch this particular wrinkle (user put a module in there, which will never ever work) and warn about that itself; maybe putting language in just in case it is this problem. |
Anyway, that means pyinvoke/invoke#556 is "it", going to have to close this one as unfixable for now :( Please follow that issue, it will be out soon! |
fab -c absolute_path_to_fabfile.py is not working. Does it need to be relative path? |
Hi,
The following code (
fabfile.py
) can cause an error by specifying an "import os
"Run the above code:
on Windows
or
on Ubuntu 18
will yield the following exception
The exception disappears when I remove the line
import os
Environment
Windows 10, Ubuntu 18
Python 3.6.4
Fabric 2.1.3
The text was updated successfully, but these errors were encountered: