Reputation: 188
I have a basic code which doesn't run:
def hello():
print("uptime")
When I run the following command in terminal fab hello
I get this error:
No idea what 'hello' is!
Upvotes: 0
Views: 998
Reputation: 11
Instead of using this,
from fabric import task
@task
def hello():
print("uptime")
fabric has been expecting like this,
from fabric import task
@task
def hello(c):
print("uptime")
passing an argument (c) as the first argument for each task since Fabric expects the Connection object as the first argument
Hope this solves for someone
Upvotes: 1
Reputation: 806
The issue is that the new fabric task method (as discussed here - http://docs.fabfile.org/en/1.14/usage/tasks.html) is to use the @task decorator. The equivalent example for your code is:
from fabric import task
@task
def hello():
print("uptime")
Running fab hello
should yield the expected output.
Source: https://github.com/fabric/fabric/issues/1854#issuecomment-414639606
Upvotes: 2